:root {
  --app-bg: #f0f2f5;
  --app-surface: #fff;
  --app-muted: #8c8c8c;
  --side-bg: #304156;
  --side-active: #263445;
  --side-sub: #1f2d3d;
  --side-sub-active: #001528;
  --side-text: #bfcbd9;
  --side-text-active: #fff;
  --brand-row: #263445;
  --accent: #409eff;
  --accent-hover: #66b1ff;
  --brand: #e8a33d;
  --ok: #10b981;
  --warn: #f59e0b;
  --bad: #ef4444;
  --unknown: #9ca3af;
  --border: #e4e7ed;
  --border-strong: #d8dce5;
  --text: #303133;
  --text-2: #606266;
  --text-3: #909399;
  --radius: 4px;
  --shadow-card: 0 1px 3px rgba(0, 21, 41, .08);
  font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--app-bg);
  color: var(--text);
  font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 20px; line-height: 1.35; font-weight: 500; }
h2 { font-size: 17px; line-height: 1.35; font-weight: 500; }
h3 { font-size: 15px; line-height: 1.35; font-weight: 500; }
.hidden { display: none !important; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 80;
  width: 210px;
  background: var(--side-bg);
  color: var(--side-text);
  display: flex;
  flex-direction: column;
  border: 0;
}
.app-brand-row {
  flex: 0 0 56px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  background: var(--brand-row);
  color: var(--side-text-active);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.app-nav-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.app-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 20px;
  color: var(--side-text);
  font-size: 14px;
  cursor: pointer;
}
.app-nav-link:hover {
  background: rgba(255, 255, 255, .06);
  color: var(--side-text-active);
}
.app-nav-link.active {
  background: var(--side-active);
  color: var(--side-text-active);
}
.app-nav-icon {
  width: 18px;
  display: inline-flex;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
}
.topbar {
  position: fixed;
  top: 0;
  right: 0;
  left: 210px;
  z-index: 60;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--app-surface);
  box-shadow: var(--shadow-card);
}
.breadcrumb {
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}
.user-chip {
  color: var(--text-2);
  font-size: 13px;
}
.topbar-right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--app-surface);
  color: var(--text-2);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.icon-btn:hover {
  color: var(--accent);
  border-color: var(--accent-hover);
}
.hamburger {
  display: none;
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
}
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(0, 0, 0, .35);
}
.app-main {
  margin-left: 210px;
  margin-top: 56px;
}
.page {
  max-width: none;
  padding: 20px;
}
.card, .phone-card, .panel, .usage-card {
  background: var(--app-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 16px 18px;
}
.muted {
  color: var(--text-3);
  font-size: 13px;
  margin-top: 4px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  background: var(--app-surface);
  color: var(--text-2);
  border-radius: var(--radius);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  line-height: 1;
  transition: border-color .15s, color .15s, background .15s, box-shadow .15s;
}
.btn:hover { color: var(--accent); border-color: var(--accent-hover); }
.btn.primary, .btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn.primary:hover, .btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}
.btn.danger, .btn-danger { color: var(--bad); }
.btn.danger:hover, .btn-danger:hover { border-color: var(--bad); color: var(--bad); }
input, select {
  height: 32px;
  border: 1px solid var(--border-strong);
  background: var(--app-surface);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0 10px;
  font: inherit;
  font-size: 13px;
  outline: none;
  min-width: 0;
}
input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(64, 158, 255, .12);
}
.error, .warning {
  padding: 10px 12px;
  border-radius: var(--radius);
  margin: 12px 0;
  border: 1px solid;
  font-size: 13px;
}
.error {
  background: #fef0f0;
  border-color: #fde2e2;
  color: var(--bad);
}
.warning {
  background: #fdf6ec;
  border-color: #faecd8;
  color: var(--bad);
}
.toast-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  max-width: 340px;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid;
  font-size: 13px;
  line-height: 1.5;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease;
  word-break: break-word;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.hide { opacity: 0; transform: translateY(8px); }
.toast-error { background: #fef0f0; border-color: #fde2e2; color: var(--bad); }
.group-tabs {
  display: flex;
  gap: 8px;
  margin: 0 auto 0 16px;
  overflow-x: auto;
  scrollbar-width: none;
}
.group-tabs::-webkit-scrollbar { display: none; }
.group-tab {
  flex: 0 0 auto;
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--app-surface);
  color: var(--text-2);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  white-space: nowrap;
  transition: border-color .15s, color .15s, background .15s;
}
.group-tab:hover {
  color: var(--accent);
  border-color: var(--accent-hover);
}
.group-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.phone-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 14px;
}
.phone-card {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  width: fit-content;
  max-width: 100%;
  padding: 10px;
  transition: box-shadow .16s, transform .16s, border-color .16s;
}
.phone-card:hover {
  border-color: var(--accent-hover);
  box-shadow: 0 6px 18px rgba(0, 21, 41, .12);
}
.phone-card-bar {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 0;
  min-width: 100%;
  margin-bottom: 8px;
  overflow: hidden;
}
.phone-card-bar-row {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  white-space: nowrap;
}
.phone-card-bar-meta {
  font-size: 12px;
}
.health-dot {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  background: var(--unknown);
}
.health-dot.ok { background: var(--ok); }
.health-dot.warn { background: var(--warn); }
.health-dot.bad { background: var(--bad); }
.health-dot.off, .health-dot.unknown { background: var(--unknown); }
.health-pop {
  position: absolute;
  top: 44px;
  left: 10px;
  z-index: 12;
  background: var(--app-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-2);
  white-space: nowrap;
}
.health-reboot {
  margin-top: 8px;
  height: 26px;
  padding: 0 10px;
  font-size: 12px;
}
.phone-card-bar-meta .card-keep-switch {
  margin-left: auto;
}
.phone-title-wrap {
  display: inline-flex;
  align-items: baseline;
  min-width: 0;
  flex: 0 1 auto;
}
.phone-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 600;
}
.mini-watchers {
  flex: 0 0 auto;
  color: var(--text-3);
  font-size: 12px;
}
.mini-recording {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--bad);
  font-size: 12px;
}
.mini-recording span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bad);
  animation: pulse 1.2s infinite;
}
.toggle {
  --toggle-on: var(--accent);
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  color: var(--text-2);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  user-select: none;
}
.toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.toggle-track {
  position: relative;
  width: 30px;
  height: 18px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #dcdfe6;
  transition: background .16s ease;
}
.toggle-track::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 21, 41, .22);
  transition: transform .16s ease;
}
.toggle input:checked + .toggle-track {
  background: var(--toggle-on);
}
.toggle input:checked + .toggle-track::before {
  transform: translateX(12px);
}
.toggle input:focus-visible + .toggle-track {
  outline: 2px solid var(--accent-hover);
  outline-offset: 2px;
}
.toggle-text {
  flex: 0 0 auto;
}
.card-keep-switch {
  --toggle-on: var(--accent);
}
.control-toggle-wrap {
  --toggle-on: var(--ok);
  margin-left: auto;
}
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-3);
  font-size: 13px;
  white-space: nowrap;
}
.status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--unknown);
}
.status.online::before { background: var(--ok); }
.status.offline::before { background: var(--unknown); }
.thumb-wrap, .viewer-shell, .player, .phone-card-screen {
  position: relative;
  background: #0f1720;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid #1f2937;
}
.thumb-wrap { aspect-ratio: 9 / 16; min-height: 220px; }
.phone-card-screen {
  flex: 0 0 auto;
  height: calc(100vh - 196px);
  width: auto;
  aspect-ratio: var(--ar, 9 / 16);
}
.thumb-wrap img, .phone-card-screen img, .phone-card-screen > canvas.video-layer,
.phone-card-screen > canvas.touch-layer, .phone-frame, .player img,
.viewer-shell > canvas.video-layer {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.phone-card-screen,
.phone-card-screen img {
  touch-action: none;
}
.phone-card-screen > canvas.video-layer,
.phone-card-screen > canvas.touch-layer {
  position: absolute;
  inset: 0;
}
.frame-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #bfcbd9;
  font-size: 13px;
  background: repeating-linear-gradient(135deg, #17212d, #17212d 12px, #111923 12px, #111923 24px);
}
.wake-overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px;
  border-radius: var(--radius);
  background: rgba(15, 23, 32, .78);
  color: #fff;
  text-align: center;
  pointer-events: none;
}
.wake-spinner {
  width: 30px;
  height: 30px;
  border: 3px solid rgba(255, 255, 255, .28);
  border-top-color: var(--accent-hover);
  border-radius: 50%;
  animation: wake-spin .8s linear infinite;
}
.wake-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
}
.wake-step {
  min-height: 18px;
  color: #d9e7f7;
  font-size: 13px;
  line-height: 1.35;
}
.wake-bar {
  width: min(72%, 220px);
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, .18);
}
.wake-bar-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent-hover);
  transition: width .1s linear;
}
.wake-bar-fill.indeterminate {
  width: 42%;
  animation: wake-bar 1.1s ease-in-out infinite;
}
.wake-elapsed {
  min-height: 16px;
  color: #bfcbd9;
  font-size: 12px;
  line-height: 1.3;
}
.offline-cover {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  color: #e5e7eb;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 6px;
}
.stream-fault {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 32, .88);
  color: #fecaca;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
}
.badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.badge, .badges span {
  display: inline-flex;
  align-items: center;
  height: 24px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 8px;
  background: #f4f4f5;
  color: var(--text-2);
  font-size: 12px;
}
.badge-ok { background: #f0f9eb; color: var(--ok); border-color: #e1f3d8; }
.badge-warn { background: #fdf6ec; color: var(--warn); border-color: #faecd8; }
.badge-bad { background: #fef0f0; color: var(--bad); border-color: #fde2e2; }
.empty {
  text-align: center;
  color: var(--text-3);
  padding: 48px;
}
.detail-page { max-width: none; padding: 12px 20px; }
.detail-page .warning, .detail-page .error { margin: 8px 0; }
.detail-toolbar { align-items: center; padding: 8px 16px; margin-bottom: 10px; }
.detail-toolbar h1 { font-size: 17px; }
/* 内嵌模式(?embed=1):供 talent-hub 等同域页面 iframe 嵌入,去掉侧栏/顶栏/多余 chrome,画面尽量高、信息按钮压小 */
.embed .sidebar,
.embed .sidebar-backdrop,
.embed .topbar { display: none !important; }
/* 整页竖向 flex,画面区 flex 撑满剩余高度(不依赖 JS/aspect-ratio,永不塌陷) */
.embed .app-main { margin: 0; height: 100dvh; display: flex; flex-direction: column; }
.embed .detail-page { padding: 6px; flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
/* 标题交给外层 talent-hub 头部;这里只留一条极窄的透明控制条(持续看/开始控制) */
.embed .detail-toolbar {
  flex-direction: row !important;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 2px;
  margin-bottom: 4px;
  background: transparent;
  border: 0;
}
.embed .detail-toolbar h1 { display: none; }
.embed #phoneMeta { display: none; }
.embed .detail-toolbar .actions { justify-content: flex-start; gap: 10px; }
.embed .detail-toolbar .btn { padding: 4px 12px; font-size: 12px; }
.embed .detail-toolbar .switch { font-size: 12px; }
.embed .warning { padding: 2px 6px; font-size: 11px; margin: 2px 0 0; }
.embed .detail-layout { display: flex; flex-direction: column; gap: 4px; flex: 1; min-height: 0; align-items: stretch; }
/* 画面卡片 flex 撑满剩余高度,shell 填满它,图像 object-fit:contain(已有)按比例显示 -> 永不塌陷 */
.embed .viewer-card { flex: 1; min-height: 0; padding: 0; background: transparent; border: 0; display: flex; }
.embed .viewer-shell { flex: 1; width: 100%; height: 100%; min-height: 0; max-height: none; margin: 0; padding-bottom: 0 !important; aspect-ratio: auto !important; }
/* 状态条叠到顶栏按钮行右侧空白处(提醒已移到按钮行下方,不再重叠);字号小,不占额外高度 */
.embed .control-card { position: absolute; top: 9px; right: 8px; z-index: 5; width: auto; max-width: 56%; padding: 0; background: transparent; border: 0; }
.embed .status-panel { font-size: 11px; gap: 2px 10px; flex-wrap: nowrap; overflow: hidden; }
.embed .status-panel div { font-size: 11px; white-space: nowrap; }
/* 隐藏「在看」(最次要),给控制者/状态留位,避免压到左侧按钮 */
.embed .status-panel div:nth-child(2) { display: none; }
.embed .control-card h2 { display: none; }
.embed .status-panel { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; margin-top: 0; }
/* 每项压成一行内联(标签+值同行),整条状态一行,挤进顶部 */
.embed .status-panel div { display: inline-flex; align-items: baseline; gap: 4px; border: 0; background: transparent; padding: 0; font-size: 12px; }
.embed .status-panel div strong { font-weight: 400; }
.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.switch, .check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
  font-size: 13px;
}
.detail-layout {
  display: grid;
  grid-template-columns: auto minmax(260px, 340px);
  justify-content: start;
  gap: 16px;
  align-items: start;
}
.viewer-card { padding: 8px; }
.control-card { padding: 14px; }
.viewer-shell {
  /* 高度尽量吃满,宽度按手机真实比例(JS 用真机 res 覆盖 aspect-ratio)靠左 */
  aspect-ratio: 9 / 16;
  height: calc(100dvh - 172px);
  max-height: calc(100dvh - 172px);
  margin: 0;
  width: auto;
}
.viewer-shell > canvas.video-layer,
.viewer-shell > canvas.touch-layer {
  position: absolute;
  inset: 0;
}
.viewer-shell > .phone-frame {
  position: absolute;
  inset: 0;
  z-index: 2;
}
.viewer-shell > .frame-placeholder {
  z-index: 4;
}
.viewer-shell > canvas.video-layer {
  z-index: 1;
}
.viewer-shell > canvas.touch-layer,
.phone-card-screen > canvas.touch-layer {
  z-index: 2;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.play-overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  border: 0;
  background: rgba(15, 23, 32, .64);
  color: #fff;
  font-size: 52px;
  cursor: pointer;
}
.recording-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  display: inline-flex;
  gap: 7px;
  align-items: center;
  background: rgba(0, 0, 0, .62);
  color: #fff;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
}
.recording-badge span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bad);
  animation: pulse 1.2s infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.8); opacity: .45; }
}
@keyframes wake-spin {
  to { transform: rotate(360deg); }
}
@keyframes wake-bar {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(240%); }
}
.playback-live {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--ok);
  font-size: 12px;
  white-space: nowrap;
}
.playback-live::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  animation: pulse 1.2s infinite;
}
.playback-live.fault { color: var(--bad); }
.playback-live.fault::before { background: var(--bad); }
.keyboard-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 1px 7px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  color: #2563eb;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.3;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.keyboard-badge:hover {
  border-color: #60a5fa;
  background: #dbeafe;
}
.status-panel .keyboard-badge { margin-left: 8px; }
.playback-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
}
.playback-btn:hover { background: var(--accent-hover); }
.phone-card-screen .control-warning {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 4;
  padding: 5px 8px;
  background: rgba(239, 68, 68, .9);
  color: #fff;
  border-radius: var(--radius);
  font-size: 12px;
  line-height: 1.2;
  pointer-events: none;
}
.tap-hint {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 6;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .72);
  color: #fff;
  font-size: 13px;
  white-space: nowrap;
  pointer-events: none;
}
.wake-hint {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .72);
  color: #fff;
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
}
.status-panel {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.status-panel div {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  background: #fafafa;
}
.status-panel strong {
  display: block;
  color: var(--text-3);
  font-size: 12px;
  margin-bottom: 5px;
  font-weight: 500;
}
.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.panel { padding: 16px; }
.panel.wide { grid-column: 1 / -1; }
.stack { display: grid; gap: 10px; margin-top: 12px; }
.row {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}
.row:hover { background: #f9fbff; }
.row-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}
.inline-form, .filters, .player-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.filters { padding: 14px; margin-bottom: 14px; }
.matrix-wrap { overflow-x: auto; margin-top: 12px; }
table {
  border-collapse: collapse;
  width: 100%;
  background: #fff;
  border: 1px solid var(--border);
  font-size: 13px;
}
th, td {
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  padding: 9px 10px;
  text-align: left;
  white-space: nowrap;
}
th {
  background: #f5f7fa;
  color: var(--text-2);
  font-weight: 500;
}
tr:hover td { background: #f5f7fa; }
.usage {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin: 14px 0;
}
.usage-card { padding: 14px; }
.usage-card strong { color: var(--text-2); font-weight: 500; }
.usage-card p { margin-top: 6px; font-size: 18px; color: var(--text); }
.player-panel { margin-top: 16px; }
.player {
  aspect-ratio: 16 / 9;
  min-height: 260px;
  margin: 12px 0;
}
.player-controls input[type="range"] { flex: 1 1 220px; }

@media (max-width: 767px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .2s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.open { display: block; }
  .topbar { left: 0; padding: 0 12px; }
  .hamburger { display: inline-flex; align-items: center; justify-content: center; }
  .app-main { margin-left: 0; }
  .page { padding: 14px 12px 32px; }
  .phone-grid {
    justify-content: center;
  }
  .phone-card-screen {
    height: calc(100vh - 226px);
  }
  .automation-badge {
    display: none;
  }
  .toolbar, .detail-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .actions { justify-content: flex-start; }
  .admin-grid, .detail-layout { grid-template-columns: 1fr; }
  .viewer-shell {
    width: 100%;
    max-height: none;
    height: auto;
  }
}

/* 全屏模式(首页 ⛶ 按钮):隐藏侧栏/顶栏,手机画面按「高度占满」和「N 台并排宽度占满」两者取小,放到最大 */
.fs-exit { display: none; }
body.fs .sidebar,
body.fs .sidebar-backdrop,
body.fs .topbar { display: none !important; }
body.fs .app-main { margin: 0; }
body.fs .page { padding: 6px; }
body.fs .phone-grid {
  flex-wrap: nowrap;
  justify-content: center;
  gap: 8px;
}
body.fs .phone-card { padding: 6px; }
body.fs .phone-card-bar { margin-bottom: 4px; gap: 3px; }
body.fs .phone-card-screen {
  /* --fs-n = 当前显示的手机台数(JS 写入);每台卡片额外占 14px(内边距+边框),卡片间 8px,页边 12px;
     竖向扣掉页边 12 + 卡片内边距 14 + 顶部两行信息栏约 56 */
  height: min(
    calc(100vh - 82px),
    calc(((100vw - 12px - (var(--fs-n, 1) - 1) * 8px) / var(--fs-n, 1) - 14px) / (var(--ar, 9 / 16)))
  );
}
body.fs .fs-exit {
  display: block;
  position: fixed;
  top: 6px;
  right: 6px;
  z-index: 90;
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: var(--radius);
  background: rgba(15, 23, 32, .55);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  opacity: .35;
  transition: opacity .15s;
}
body.fs .fs-exit:hover { opacity: 1; }
.fs-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
}

/* 顶栏延迟徽标 + 分段详情 */
.lat-wrap { position: relative; }
.lat-chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: 15px;
  background: var(--app-surface); color: var(--text-2);
  font-size: 13px; cursor: pointer; white-space: nowrap;
}
.lat-chip:hover { border-color: var(--accent); }
.lat-val { font-variant-numeric: tabular-nums; color: var(--text); font-weight: 500; }
.lat-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--unknown); }
.lat-chip[data-level="ok"] .lat-dot { background: var(--ok); }
.lat-chip[data-level="warn"] .lat-dot { background: var(--warn); }
.lat-chip[data-level="bad"] .lat-dot { background: var(--bad); }
.lat-pop {
  position: absolute; top: 38px; right: 0; z-index: 80;
  width: min(620px, calc(100vw - 32px));
  background: var(--app-surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: 0 6px 20px rgba(0, 21, 41, .15);
  padding: 12px 14px; font-size: 12px; line-height: 1.6; color: var(--text-2);
}
.lat-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.lat-time { font-weight: 400; color: var(--text-3); font-size: 12px; margin-left: 6px; }
.lat-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.lat-table td:first-child { width: 44%; overflow-wrap: anywhere; }
.lat-table td.lat-num { width: 14%; }
.lat-table td { white-space: normal; padding: 4px 6px 4px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.lat-num { text-align: right; white-space: nowrap; color: var(--text); font-variant-numeric: tabular-nums; font-weight: 500; }
.lat-src { color: var(--text-3); padding-left: 10px !important; width: 42%; white-space: normal; }
.lat-sub td { color: var(--text-3); }
.lat-total td { font-weight: 600; color: var(--text); border-bottom: none; }
.lat-bad { color: var(--bad); }
.lat-route { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border-strong); }
.lat-route b { color: var(--text); font-weight: 500; }
.lat-verdict { margin-top: 6px; color: var(--text); }
.lat-hint, .lat-err { margin-top: 6px; color: var(--text-3); }
.lat-err { color: var(--bad); }
@media (max-width: 720px) {
  .lat-src { display: none; }
  .lat-table td:first-child { width: auto; }
  .lat-table td.lat-num { width: 76px; }
  .lat-chip { padding: 0 8px; }

  .lat-pop { position: fixed; top: 60px; left: 16px; right: 16px; width: auto; max-height: calc(100vh - 76px); overflow: auto; }
  .fs-btn { white-space: nowrap; }
}

/* 登录页 + 顶栏用户操作 */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.login-card { width: min(360px, 100%); padding: 28px 24px; display: flex; flex-direction: column; gap: 14px; }
.login-card h1 { font-size: 20px; text-align: center; margin-bottom: 4px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); }
.login-card input { height: 36px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--radius); font-size: 14px; }
.login-card input:focus { outline: none; border-color: var(--accent); }
.login-card .btn { height: 38px; justify-content: center; }
.login-error { color: var(--bad); font-size: 13px; }
.login-hint { font-size: 12px; text-align: center; }
.user-chip { display: inline-flex; align-items: center; gap: 8px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--text-3); font-size: 12px; cursor: pointer; }
.link-btn:hover { color: var(--accent); }
.row-actions { display: inline-flex; gap: 8px; }
.text-bad { color: var(--bad); }
@media (max-width: 720px) {
  .user-chip .link-btn[data-act="pw"] { display: none; }
}

/* 延迟面板:线路切换(内网/外网、机场开关) */
.lat-ctl { margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border-strong); display: flex; flex-direction: column; gap: 8px; }
.lat-ctl-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.lat-ctl-label { font-weight: 600; color: var(--text); min-width: 32px; }
.lat-ctl-note { color: var(--text-3); flex: 1 1 220px; min-width: 0; }
label.lat-ctl-note { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; }
.lat-ctl-note b { color: var(--text); font-weight: 500; }
.lat-seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 15px; overflow: hidden; }
.lat-seg button { border: 0; background: var(--app-surface); color: var(--text-2); padding: 4px 12px; font-size: 12px; cursor: pointer; }
.lat-seg button + button { border-left: 1px solid var(--border-strong); }
.lat-seg button.active { background: var(--accent); color: #fff; cursor: default; }
.lat-seg button:disabled:not(.active) { opacity: .5; cursor: default; }
.lat-secret { display: inline-flex; gap: 6px; }
.lat-secret input { height: 28px; padding: 0 8px; border: 1px solid var(--border-strong); border-radius: var(--radius); font-size: 12px; width: 180px; }
.lat-secret .btn { height: 28px; }

/* 延迟面板:线路图 */
.lat-path { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 2px; margin: 4px 0 10px; }
.lat-node { display: inline-flex; flex-direction: column; padding: 4px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--app-bg); max-width: 180px; }
.lat-node b { font-size: 12px; color: var(--text); font-weight: 600; }
.lat-node small { font-size: 11px; color: var(--text-3); overflow-wrap: anywhere; }
.lat-arrow { display: inline-flex; flex-direction: column; align-items: center; color: var(--text-3); font-size: 12px; padding: 0 2px; }
.lat-arrow span { font-size: 11px; color: var(--accent); white-space: nowrap; min-height: 14px; }

/* 当前线路标签(一眼看出 机场 / 直连 / 内网) */
.lat-mode { display: inline-block; margin-bottom: 10px; padding: 4px 10px; border-radius: 12px; font-size: 13px; font-weight: 600; }
.lat-mode-airport { background: #f3e8ff; color: #7c3aed; }
.lat-mode-direct { background: #e0f2fe; color: #0369a1; }
.lat-mode-lan { background: #dcfce7; color: #15803d; }
.lat-mode-cf { background: #fef3c7; color: #b45309; }
.lat-chip[data-mode="airport"] .lat-word { color: #7c3aed; font-weight: 600; }
.lat-chip[data-mode="lan"] .lat-word { color: #15803d; font-weight: 600; }
