:root {
  --bg: #0b1120;
  --bg-card: #111a2e;
  --bg-elev: #17233b;
  --border: #253453;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --primary: #4f46e5;
  --primary-hover: #6366f1;
  --ok: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.hidden { display: none !important; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.muted { color: var(--muted); font-size: 13px; }

/* Buttons & Inputs */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { background: #1e2d4d; border-color: #3a4f7a; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { background: rgba(239, 68, 68, 0.15); border-color: rgba(239, 68, 68, 0.5); color: #fca5a5; }
.btn.danger:hover { background: rgba(239, 68, 68, 0.3); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.xs { padding: 3px 7px; font-size: 11px; }
.btn.full { width: 100%; }

.input {
  width: 100%;
  padding: 9px 12px;
  background: #0d1526;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.input:focus { border-color: var(--primary-hover); }
.input.sm { padding: 5px 9px; font-size: 12px; }
textarea.input { min-height: 76px; resize: vertical; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.form-error { color: #fca5a5; font-size: 12px; min-height: 18px; margin-bottom: 8px; }

/* Login */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at top, #172554 0%, #0b1120 60%);
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.login-card h1 { margin: 12px 0 6px; font-size: 22px; }
.brand-badge {
  display: inline-block;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.16);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.35);
}
.seg-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 16px 0;
  background: #0d1526;
  padding: 4px;
  border-radius: 10px;
}
.seg-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 7px;
  border-radius: 7px;
  font-size: 13px;
  cursor: pointer;
}
.seg-btn.active { background: var(--bg-elev); color: #fff; font-weight: 600; }

/* Topbar & Shell */
.app-shell { display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; }
.logo-mark {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}
.brand-title { font-weight: 700; font-size: 15px; }
.brand-sub { font-size: 11px; color: var(--muted); }
.user-pill { font-size: 13px; font-weight: 500; }
.role-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}
.role-badge.admin { background: rgba(99, 102, 241, 0.2); color: #a5b4fc; border: 1px solid rgba(99, 102, 241, 0.4); }
.role-badge.user { background: rgba(16, 185, 129, 0.16); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.4); }

.main-nav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}
.nav-btn:hover { color: var(--text); background: var(--bg-elev); }
.nav-btn.active { background: var(--primary); color: #fff; }
.badge-danger {
  background: var(--danger);
  color: #fff;
  border-radius: 999px;
  padding: 1px 6px;
  font-size: 11px;
  margin-left: 4px;
}

.container { max-width: 1180px; width: 100%; margin: 0 auto; padding: 24px 20px; }
.admin-main { flex: 1; display: flex; flex-direction: column; padding: 16px 20px; }
.panel { flex: 1; display: flex; flex-direction: column; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}
.section-head h2 { margin: 0; font-size: 17px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Card Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.app-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s, border-color 0.15s;
}
.app-card:hover { transform: translateY(-2px); border-color: #3b5280; }
.app-card-accent { position: absolute; top: 0; left: 0; right: 0; height: 3px; }
.app-card-head { display: flex; align-items: flex-start; gap: 12px; }
.app-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--bg-elev);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.app-name { font-size: 16px; font-weight: 700; }
.app-desc { font-size: 13px; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.app-meta { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }

.status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
}
.status-pill.online { background: rgba(16, 185, 129, 0.16); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.4); }
.status-pill.offline, .status-pill.error { background: rgba(239, 68, 68, 0.18); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.5); }
.status-pill.unknown { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.35); }

.alert-banner {
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fecaca;
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 14px;
  font-size: 13px;
}

/* Free Browser & Remote Viewer */
.free-toolbar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px 10px 0 0;
  padding: 8px 10px;
}
.free-controls { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.inline-label { font-size: 12px; color: var(--muted); }
.select-proxy { width: 175px; }
.select-app { width: 155px; }
.url-bar-form { flex: 1; display: flex; gap: 6px; min-width: 220px; }
.bookmarks-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid rgba(37, 52, 83, 0.7);
  flex-wrap: wrap;
}
.bookmark-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(79, 70, 229, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #c7d2fe;
  cursor: pointer;
  white-space: nowrap;
}
.bookmark-chip:hover { background: rgba(79, 70, 229, 0.28); color: #fff; }

.select-compact { width: auto; min-width: 82px; padding-left: 6px; padding-right: 6px; font-size: 12px; }
.input.xs { padding: 3px 6px; font-size: 11px; border-radius: 6px; height: 26px; }
.rtt-badge {
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.16);
  color: #6ee7b7;
  white-space: nowrap;
}
.rtt-badge.warn { background: rgba(245, 158, 11, 0.18); color: #fcd34d; }
.rtt-badge.bad { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }

/* 远控软件式顶部自动收起悬浮胶囊 */
.remote-dock {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: calc(100vw - 24px);
  pointer-events: auto;
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s;
}
.remote-dock .dock-content {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 12px;
  margin-top: 6px;
  background: rgba(12, 19, 34, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
  transition: opacity 0.18s;
}
.remote-dock .dock-handle {
  width: 68px;
  height: 5px;
  margin-top: 4px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.48);
  cursor: pointer;
  transition: width 0.18s, background 0.18s, opacity 0.18s;
}
.remote-dock:hover .dock-handle,
.remote-dock.pinned .dock-handle {
  opacity: 0.25;
}
.remote-dock.collapsed:not(:hover):not(:focus-within):not(.pinned) {
  transform: translate(-50%, calc(-100% + 12px));
}
.remote-dock.collapsed:not(:hover):not(:focus-within):not(.pinned) .dock-content {
  opacity: 0;
  pointer-events: none;
}
.remote-dock.collapsed:not(:hover):not(:focus-within):not(.pinned) .dock-handle {
  width: 88px;
  background: rgba(99, 102, 241, 0.72);
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.35);
}
.remote-dock.pinned [id$="-pin-btn"] {
  background: rgba(99, 102, 241, 0.28);
  border-color: rgba(129, 140, 248, 0.65);
  color: #e0e7ff;
}

body.browser-immersive #admin-view > .topbar,
body.browser-immersive #panel-free > .free-toolbar {
  display: none !important;
}
body.browser-immersive #admin-view .admin-main {
  padding: 0;
}
body.browser-immersive #free-viewer-stage {
  position: fixed;
  inset: 0;
  z-index: 70;
  height: 100vh !important;
  border: 0;
  border-radius: 0;
}

/* 统一所有管理页面：导航菜单收进左侧边缘滑出抽屉（彻底避开右侧滚动条误触） */
#admin-view > .topbar.left-drawer {
  position: fixed;
  top: 0;
  left: 0;
  right: auto;
  bottom: 0;
  width: 248px;
  max-width: 84vw;
  z-index: 105;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 14px;
  padding: 16px 14px;
  border-bottom: 0;
  border-right: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(11, 18, 32, 0.96);
  backdrop-filter: blur(14px);
  box-shadow: 12px 0 36px rgba(0, 0, 0, 0.52);
  transform: translateX(-100%);
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
body.right-drawer-open #admin-view > .topbar.left-drawer,
#admin-view > .topbar.left-drawer:hover {
  transform: translateX(0);
}
#admin-view > .topbar.left-drawer .topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
#admin-view > .topbar.left-drawer .drawer-close-btn {
  margin-left: auto;
}
#admin-view > .topbar.left-drawer .main-nav {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}
#admin-view > .topbar.left-drawer .nav-btn {
  text-align: left;
  padding: 9px 12px;
}
#admin-view > .topbar.left-drawer .topbar-right {
  margin-top: auto;
  flex-wrap: wrap;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
  padding-top: 12px;
}

.floating-left-menu-btn {
  position: fixed;
  top: 14px;
  left: 16px;
  z-index: 98;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.88);
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(10px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}
.floating-left-menu-btn:hover {
  border-color: var(--primary-hover);
  color: #fff;
}
body.free-workspace .floating-left-menu-btn,
body.browser-immersive .floating-left-menu-btn {
  display: none !important;
}

.left-drawer-trigger {
  height: 28px;
  width: 28px;
  border-radius: 8px;
  color: #94a3b8;
}

/* 网页加载蓝色跑马灯动态进度条 */
.loading-marquee {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  overflow: hidden;
  background: rgba(59, 130, 246, 0.14);
  z-index: 103;
  pointer-events: none;
}
.loading-marquee.overlay-marquee {
  position: fixed;
  top: 0;
  bottom: auto;
}
.loading-marquee::before {
  content: '';
  position: absolute;
  top: 0;
  left: -40%;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, transparent, #3b82f6 35%, #60a5fa 65%, transparent);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.8);
  animation: loadingMarqueeSlide 1.15s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes loadingMarqueeSlide {
  0% { left: -40%; }
  100% { left: 100%; }
}

body.free-workspace #admin-view .admin-main {
  padding: 0;
  max-width: none;
}
body.free-workspace #free-viewer-stage {
  height: calc(100dvh - 40px);
  min-height: 320px;
  border: 0;
  border-radius: 0;
}

.hud-stats-line {
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.14);
}

.touch-ripple {
  position: absolute;
  width: 24px;
  height: 24px;
  margin-left: -12px;
  margin-top: -12px;
  border-radius: 50%;
  border: 2px solid rgba(129, 140, 248, 0.9);
  background: rgba(99, 102, 241, 0.25);
  pointer-events: none;
  z-index: 80;
  animation: touchRippleAnim 0.36s ease-out forwards;
}
@keyframes touchRippleAnim {
  from { transform: scale(0.5); opacity: 0.95; }
  to { transform: scale(2.1); opacity: 0; }
}

.section-head {
  padding-left: 96px;
  padding-right: 0;
}

.remote-context-menu {
  position: fixed;
  z-index: 230;
  min-width: 214px;
  padding: 5px;
  border-radius: 10px;
  background: rgba(20, 25, 38, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  gap: 1px;
  user-select: none;
}
.remote-context-menu button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  text-align: left;
  background: transparent;
  border: 0;
  color: #e2e8f0;
  font-size: 12.5px;
  line-height: 1.3;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.remote-context-menu button:hover:not(:disabled) {
  background: rgba(59, 130, 246, 0.24);
  color: #fff;
}
.remote-context-menu button:disabled {
  color: rgba(148, 163, 184, 0.42);
  cursor: default;
}
.remote-context-menu button.ctx-danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.22);
  color: #fecaca;
}
.remote-context-menu .ctx-shortcut {
  font-size: 11px;
  color: rgba(148, 163, 184, 0.72);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, sans-serif;
  letter-spacing: 0.2px;
}
.remote-context-menu .ctx-sep {
  height: 1px;
  margin: 4px 8px;
  background: rgba(255, 255, 255, 0.09);
}

@media (max-width: 768px) {
  .admin-main { padding: 14px 12px 24px; }
  .section-head { flex-wrap: wrap; gap: 8px; padding-right: 92px; }
  .card-grid { grid-template-columns: 1fr; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .free-slim-bar { height: 44px; padding: 0 6px !important; gap: 4px; }
  .free-slim-actions { gap: 4px; }
  #free-tools-toggle-btn { padding: 4px 8px; }
  body.free-workspace #free-viewer-stage { height: calc(100dvh - 44px); }
  .viewer-overlay .full-stage { height: 100dvh; }
  .free-tools-popover {
    position: fixed;
    top: 48px;
    left: 8px;
    right: 8px;
    width: auto;
    max-height: calc(100dvh - 60px);
    overflow-y: auto;
    padding: 12px;
  }
  .free-tools-popover .popover-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .free-tools-popover .popover-row:first-child {
    display: flex;
    flex-wrap: nowrap;
  }
  .free-tools-popover .select-compact,
  .free-tools-popover .select-proxy,
  .free-tools-popover .select-app {
    width: 100%;
    min-height: 36px;
  }
  .remote-dock {
    max-width: calc(100vw - 12px);
  }
  .remote-dock .dock-content {
    border-radius: 14px;
    padding: 8px;
    gap: 5px;
    justify-content: flex-start;
  }
  .btn.xs, .btn.sm { min-height: 34px; }
}

.free-slim-bar {
  position: relative;
  height: 40px;
  padding: 0 10px !important;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #0b0f19 !important;
  border-radius: 0 !important;
  border-left: 0 !important;
  border-right: 0 !important;
  border-top: 0 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}
.ui-ico {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  display: block;
}
.control-island {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  flex-shrink: 0;
}
.island-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 24px;
  min-width: 28px;
  padding: 0 8px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #94a3b8;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.island-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #f8fafc;
}
.island-btn:active {
  background: rgba(99, 102, 241, 0.28);
  color: #fff;
}
.island-status-btn {
  padding: 0 9px;
}
.island-status-btn .rtt-badge {
  background: transparent;
  padding: 0;
  font-variant-numeric: tabular-nums;
}
.rtt-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.7);
  flex-shrink: 0;
}
.island-sep {
  width: 1px;
  height: 14px;
  background: rgba(255, 255, 255, 0.1);
  margin: 0 1px;
}
.cc-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cc-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #64748b;
}
.cc-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.cc-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}
.cc-grid-3 .input,
.cc-grid-4 .btn {
  width: 100%;
  justify-content: center;
}
@media (max-width: 768px) {
  .cc-grid-3 { grid-template-columns: 1fr; }
  .cc-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.slim-tabs {
  margin-top: 0 !important;
  flex: 1;
  min-width: 0;
  flex-wrap: nowrap !important;
  overflow-x: auto;
  scrollbar-width: none;
}
.slim-tabs::-webkit-scrollbar { display: none; }
.free-slim-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.url-pill-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  max-width: 240px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.72);
  color: #cbd5e1;
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.16s, background 0.16s, color 0.16s;
}
.url-pill-trigger:hover {
  border-color: rgba(129, 140, 248, 0.75);
  background: rgba(30, 41, 59, 0.9);
  color: #fff;
}
.url-pill-host {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 155px;
}
.url-pill-kbd {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(148, 163, 184, 0.16);
  color: #94a3b8;
}
.url-spotlight {
  position: fixed;
  top: 52px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  width: min(640px, calc(100vw - 24px));
  padding: 6px;
  border-radius: 16px;
  background: rgba(15, 20, 32, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.68), 0 0 0 1px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: spotlightIn 0.14s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes spotlightIn {
  from { opacity: 0; transform: translate(-50%, -6px) scale(0.985); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
.spotlight-shell {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 4px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.spotlight-shell:focus-within {
  border-color: rgba(96, 165, 250, 0.55);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
}
.spotlight-nav-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.spotlight-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.spotlight-nav-btn svg { width: 15px; height: 15px; }
.spotlight-nav-btn:hover { background: rgba(255, 255, 255, 0.09); color: #f8fafc; }
.spotlight-sep {
  width: 1px;
  height: 18px;
  background: rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}
.spotlight-form {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.spotlight-search-ico {
  width: 15px;
  height: 15px;
  color: #64748b;
  flex-shrink: 0;
}
.spotlight-input {
  flex: 1;
  min-width: 0;
  height: 36px;
  border: 0;
  background: transparent;
  color: #f8fafc;
  font-size: 14px;
  outline: none;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, sans-serif;
}
.spotlight-input::placeholder { color: #64748b; }
.spotlight-star-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s ease, color 0.12s ease;
}
.spotlight-star-btn svg { width: 15px; height: 15px; }
.spotlight-star-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
}
.spotlight-star-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.spotlight-star-btn.is-starred {
  color: #f59e0b;
}
.spotlight-star-btn.is-starred svg {
  fill: currentColor;
}
.bm-group-label {
  font-size: 11px;
  color: #64748b;
  padding: 0 4px;
  user-select: none;
}
.bookmark-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  max-width: 170px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  font-size: 11.5px;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.bookmark-chip:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(148, 163, 184, 0.28);
  color: #fff;
}
.bm-ico {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  color: #60a5fa;
}
.bm-url-chip .bm-ico { color: #f59e0b; }
.bm-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bm-del-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  margin-right: -3px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.bm-del-btn svg { width: 10px; height: 10px; }
.bookmark-chip:hover .bm-del-btn { opacity: 0.8; }
.bm-del-btn:hover {
  opacity: 1 !important;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.spotlight-go-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 10px;
  border-radius: 7px;
  border: 1px solid rgba(96, 165, 250, 0.35);
  background: rgba(59, 130, 246, 0.22);
  color: #dbeafe;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s ease, color 0.12s ease;
}
.spotlight-go-btn kbd {
  font-size: 11px;
  opacity: 0.78;
  font-family: inherit;
}
.spotlight-go-btn:hover {
  background: rgba(59, 130, 246, 0.38);
  color: #fff;
}

/* VPS 隐藏内存告警点 & 监控面板 & 可开关浮动文字 */
.island-status-btn { position: relative; }
.vps-alert-dot {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 0 2px #0b0f19;
}
.vps-alert-dot.critical {
  background: #ef4444;
  animation: vpsPulse 1.4s ease-in-out infinite;
}
@keyframes vpsPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.25); }
}
.cc-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.cc-label-row .cc-label { margin-bottom: 0; }
.vps-metrics-bars {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.vps-bar-item {
  display: grid;
  grid-template-columns: 36px 1fr 92px;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: #cbd5e1;
}
.vps-bar-name { color: #94a3b8; }
.vps-bar-track {
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.vps-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: #3b82f6;
  transition: width 0.35s ease, background 0.25s ease;
}
.vps-bar-fill.warn { background: #f59e0b; }
.vps-bar-fill.crit { background: #ef4444; }
.vps-bar-val {
  text-align: right;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: #cbd5e1;
}
.vps-metrics-hud {
  position: fixed;
  right: 12px;
  bottom: 10px;
  z-index: 105;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(9, 13, 24, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  color: rgba(226, 232, 240, 0.88);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  letter-spacing: 0.2px;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
}
.vps-metrics-hud.warn {
  border-color: rgba(245, 158, 11, 0.5);
  color: #fde68a;
}
.vps-metrics-hud.crit {
  border-color: rgba(239, 68, 68, 0.65);
  color: #fecaca;
  background: rgba(69, 10, 10, 0.78);
}
@media (max-width: 768px) {
  .url-pill-trigger { max-width: 136px; padding: 0 8px; }
  .url-pill-kbd { display: none; }
}
.free-tools-popover {
  position: absolute;
  top: 44px;
  right: 10px;
  z-index: 115;
  width: min(440px, calc(100vw - 20px));
  padding: 14px;
  border-radius: 14px;
  background: rgba(15, 20, 32, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cc-section {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.cc-section:last-of-type {
  padding-bottom: 0;
  border-bottom: 0;
}
.cc-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: #64748b;
}
.cc-ico {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  display: block;
}
.cc-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035);
  color: #cbd5e1;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}
.cc-action-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(148, 163, 184, 0.25);
  color: #f8fafc;
}
.cc-action-btn.is-active {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(96, 165, 250, 0.45);
  color: #dbeafe;
}
.dock-ico-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 0 6px !important;
}
.popover-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.popover-row .url-bar-form {
  flex: 1;
  min-width: 200px;
}
.tabs-strip {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 0;
}
.tabs-strip::-webkit-scrollbar { display: none; }
.tab-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  max-width: 200px;
  min-width: 84px;
  padding: 0 6px 0 10px;
  border-radius: 7px;
  font-size: 12px;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}
.tab-chip:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #e2e8f0;
}
.tab-chip.active {
  background: rgba(30, 41, 59, 0.92);
  border-color: rgba(148, 163, 184, 0.22);
  color: #f8fafc;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
}
.tab-chip.is-hibernated {
  opacity: 0.58;
  border-style: dashed;
  border-color: rgba(148, 163, 184, 0.22);
}
.tab-chip.is-hibernated:hover {
  opacity: 0.92;
}
.tab-sleep-ico { color: #94a3b8; }
.tab-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  opacity: 0.72;
}
.tab-chip.active .tab-icon { opacity: 0.95; color: #60a5fa; }
.tab-spinner {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1.6px solid rgba(96, 165, 250, 0.28);
  border-top-color: #60a5fa;
  animation: tabSpin 0.75s linear infinite;
}
@keyframes tabSpin {
  to { transform: rotate(360deg); }
}
.tab-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tab-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  opacity: 0;
  flex-shrink: 0;
  transition: opacity 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.tab-close-btn svg { width: 11px; height: 11px; }
.tab-chip.active .tab-close-btn,
.tab-chip:hover .tab-close-btn { opacity: 0.78; }
.tab-close-btn:hover {
  opacity: 1 !important;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.tab-add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 7px;
  background: transparent;
  border: 1px solid transparent;
  color: #94a3b8;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.14s ease, color 0.14s ease;
}
.tab-add-btn svg { width: 13px; height: 13px; }
.tab-add-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.viewer-stage {
  position: relative;
  background: #050811;
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.inline-stage { height: calc(100vh - 210px); min-height: 460px; border-top: 0; border-radius: 0 0 10px 10px; }
.full-stage { flex: 1; border: 0; }
.empty-stage { text-align: center; color: var(--muted); padding: 32px; }

.remote-video {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  pointer-events: none;
  z-index: 1;
}
.remote-canvas {
  position: relative;
  z-index: 2;
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  cursor: default;
  outline: none;
}
.viewer-stage.viewer-letterboxed {
  background: radial-gradient(circle at center, #0c1324 0%, #050811 100%);
}
.viewer-stage.viewer-letterboxed .remote-video,
.viewer-stage.viewer-letterboxed .remote-canvas {
  border-radius: 6px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.remote-js-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 220;
  background: rgba(3, 6, 14, 0.58);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.remote-js-dialog {
  width: min(420px, 92vw);
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.65);
  color: var(--text);
}
.remote-js-dialog-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}
.remote-js-dialog-msg {
  font-size: 13px;
  line-height: 1.5;
  color: #cbd5e1;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow: auto;
}
.remote-js-dialog-input {
  width: 100%;
  margin-top: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(2, 6, 23, 0.75);
  color: #fff;
  font-size: 13px;
  outline: none;
}
.remote-js-dialog-input:focus {
  border-color: var(--primary-hover);
}
.remote-js-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.ext-proto-bar {
  position: fixed;
  top: 52px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 210;
  max-width: min(680px, calc(100vw - 24px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.94);
  border: 1px solid rgba(96, 165, 250, 0.35);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px);
}
.ext-proto-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.ext-proto-badge {
  flex-shrink: 0;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  border: 1px solid rgba(96, 165, 250, 0.3);
}
.ext-proto-text {
  font-size: 12px;
  color: #e2e8f0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ext-proto-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.ime-sink {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 2px;
  height: 2px;
  opacity: 0;
  border: 0;
  padding: 0;
  resize: none;
}

.viewer-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: #050811;
  display: block;
}
.viewer-overlay .full-stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  border: 0;
}
.viewer-bar-left, .viewer-bar-right { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.viewer-app-title { font-weight: 700; font-size: 13px; padding: 0 4px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conn-pill { font-size: 11px; color: #6ee7b7; padding: 2px 8px; border-radius: 999px; background: rgba(16, 185, 129, 0.14); white-space: nowrap; }
.block-banner {
  position: absolute;
  top: 56px;
  left: 16px;
  right: 16px;
  z-index: 65;
  border-radius: 10px;
  background: rgba(120, 53, 15, 0.94);
  border: 1px solid rgba(245, 158, 11, 0.65);
  color: #fde68a;
  padding: 10px 16px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

/* Tables & Filters */
.filter-bar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.filter-bar .input { max-width: 240px; }
.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.data-table th { color: var(--muted); font-weight: 600; font-size: 12px; background: rgba(15, 23, 42, 0.5); }

/* Modals & Toasts */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(2, 6, 23, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.modal-card {
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-head h3 { margin: 0; font-size: 16px; }
.checkbox-grid { display: flex; flex-direction: column; gap: 6px; max-height: 160px; overflow-y: auto; padding: 8px; background: #0d1526; border-radius: 8px; border: 1px solid var(--border); }
.checkbox-item { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }

.toast-container {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  max-width: 360px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}
.toast.error { border-color: rgba(239, 68, 68, 0.6); color: #fecaca; }
.toast.ok { border-color: rgba(16, 185, 129, 0.6); color: #a7f3d0; }

/* Account Pool & App Profile Switcher */
.app-profile-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0;
}
.app-profile-row > span {
  white-space: nowrap;
  flex-shrink: 0;
}
.app-profile-switch {
  flex: 1;
  min-width: 0;
  max-width: 220px;
  height: 26px;
  padding: 2px 8px;
  font-size: 12px;
}
.profile-app-tag {
  display: inline-block;
  padding: 2px 8px;
  margin: 2px 4px 2px 0;
  font-size: 12px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.14);
  border: 1px solid rgba(59, 130, 246, 0.32);
  color: #bfdbfe;
}
.island-btn.is-active {
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.18);
}

/* Remote Browser Download Tray */
.remote-download-tray {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(380px, calc(100vw - 32px));
}
.remote-dl-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(96, 165, 250, 0.35);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(14px);
}
.remote-dl-item.is-done {
  border-color: rgba(16, 185, 129, 0.5);
}
.remote-dl-item .dl-ico {
  width: 18px;
  height: 18px;
  color: #60a5fa;
  flex-shrink: 0;
}
.remote-dl-item.is-done .dl-ico {
  color: #34d399;
}
.remote-dl-body {
  flex: 1;
  min-width: 0;
}
.remote-dl-name {
  font-size: 13px;
  font-weight: 600;
  color: #f1f5f9;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.remote-dl-sub {
  font-size: 11.5px;
  color: #94a3b8;
  margin-top: 2px;
}
.remote-dl-bar {
  height: 4px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
  margin-top: 6px;
  overflow: hidden;
}
.remote-dl-fill {
  height: 100%;
  background: #3b82f6;
  transition: width 0.2s ease;
}
.remote-dl-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
