/* style.css - Device Monitor (Apple Style System Status) */
:root { color-scheme: light; }

* { box-sizing: border-box; }

html { background: #f5f7fb; }
html.dark { background: #06101d; }
/* Full-viewport backdrop: a real fixed element so the day/night base color
   repaints reliably on iOS when switching theme (overscroll area otherwise
   keeps the old color until a reload). */
.theme-backdrop { position: fixed; inset: 0; z-index: -1; background: #f5f7fb; }
body.dark .theme-backdrop { background: #06101d; }

/* 无 view_note 权限时，隐藏设备备注（用户）列与相关展示 */
body.no-view-note .td-user,
body.no-view-note .td-note,
body.no-view-note .dev-note,
body.no-view-note .mob-dev-note,
body.no-view-note .live-room-note,
body.no-view-note .bulk-device-note,
body.no-view-note th.th-user,
body.no-view-note .overview-card-user,
body.no-view-note .ss-note-row { display: none !important; }
/* 个人主页：对所有登录用户可见（不受 no-view-note 隐藏影响），与 Live 状态分隔 */
.ss-homepage-row { margin-top: 6px; }

/* --- 「預備中」徽标：首页「状况」列里紧挨「放送中」显示 ---
   形态与 .live-badge 完全对称（同尺寸/圆角/字重/圆点+发光），只把绿色换成橙色、
   闪得更快一点（1s vs 1.4s），表示"还没开播、正在预备"。 */
.prep-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: #ea580c;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid #f97316;
  animation: prepPulse 1s ease-in-out infinite;
  text-shadow: 0 0 8px rgba(249, 115, 22, 0.6);
  vertical-align: middle;
  letter-spacing: .02em;
  white-space: nowrap;
  cursor: pointer;
}
.prep-badge:hover { filter: brightness(1.12); text-decoration: underline; }
.prep-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f97316;
  animation: prepDot 1s ease-in-out infinite;
  box-shadow: 0 0 6px #f97316;
  display: inline-block;
  vertical-align: middle;
  margin-right: 2px;
}
@keyframes prepPulse {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 10px rgba(249, 115, 22, 0.22), inset 0 0 4px rgba(249, 115, 22, 0.08);
    text-shadow: 0 0 8px rgba(249, 115, 22, 0.6);
  }
  50% {
    opacity: .5;
    box-shadow: 0 0 3px rgba(249, 115, 22, 0.08);
    text-shadow: none;
  }
}
@keyframes prepDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.5); opacity: .5; }
}
body.dark .prep-badge { color: #fb923c; border-color: #fb923c; }
body.dark .prep-badge::before { background: #fb923c; box-shadow: 0 0 6px #fb923c; }

/* --- 直播设置：批量勾选设备（紧凑列表，非卡片）--- */
.bulk-pick-toolbar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 6px 0;
}
.bulk-device-list {
  max-height: 260px; overflow-y: auto;
  border: 1px solid #e2e8f0; border-radius: 8px;
  background: #fff; padding: 4px;
}
.bulk-device-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; border-radius: 6px; font-size: 13px;
  cursor: pointer; min-width: 0;
}
.bulk-device-row:hover { background: #f1f5f9; }
.bulk-device-row input[type="checkbox"] { flex: 0 0 auto; margin: 0; }
.bulk-device-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bulk-device-note { color: #0284c7; font-size: 12px; white-space: nowrap; }
.bulk-device-tag {
  margin-left: auto; flex: 0 0 auto;
  font-size: 11px; color: #64748b;
  background: #f1f5f9; border: 1px solid #e2e8f0;
  border-radius: 999px; padding: 1px 7px;
}
body.dark .bulk-device-list { background: #131c31; border-color: #1e293b; }
body.dark .bulk-device-row:hover { background: #1e293b; }
body.dark .bulk-device-note { color: #38bdf8; }
body.dark .bulk-device-tag { color: #94a3b8; background: #0f172a; border-color: #1e293b; }
body {
  font-family: -apple-system, BlinkMacSystemFont, system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f5f7fb;
  color: #0f172a;
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ===== Header ===== */
header {
  padding: 24px 20px 14px;
  border-bottom: 1px solid #e5e5e7;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  position: sticky;
  top: 0;
  z-index: 100;
}

/* ===== Layout ===== */
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 20px; }
.main { padding: 18px 20px 40px; }
.row { display: flex; align-items: center; gap: 10px; }
.toolbar { display: flex; justify-content: flex-start; align-items: center; gap: 16px; flex-wrap: wrap; }
.toolbar > div:first-child { min-width: 0; }
.toolbar .row { margin-left: auto; }
.title { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.site-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
  flex: 0 0 auto;
}
.muted { color: #64748b; font-size: 13px; }

/* ===== Header loading: 电脑互联 animation ===== */
.status-loading { display: inline-flex; align-items: center; gap: 6px; }
.status-logo { display: block; }
.status-logo .sl-dev-l { animation: slPulseL 1.6s ease-in-out infinite; transform-origin: 9px 12px; }
.status-logo .sl-dev-r { animation: slPulseR 1.6s ease-in-out infinite; transform-origin: 35px 12px; }
.status-logo .sl-sig { animation: slFlow 1s linear infinite; }
.status-logo .sl-packet { animation: slPacket 1.5s ease-in-out infinite; }
@keyframes slPulseL { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }
@keyframes slPulseR { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
@keyframes slFlow { to { stroke-dashoffset: -12; } }
@keyframes slPacket {
  0% { transform: translateX(0); opacity: 0; }
  15% { opacity: 1; }
  85% { opacity: 1; }
  100% { transform: translateX(12px); opacity: 0; }
}
body.dark .status-logo .sl-sig { stroke: #64748b; }

/* ===== Header status dot (after load) ===== */
.hs-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  margin-right: 6px;
  vertical-align: middle;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
  animation: hsPulse 1.8s ease-out infinite;
}
@keyframes hsPulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* ===== Cards / Stats ===== */
.grid.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.card {
  background: #fff;
  border: 1px solid #e5e5e7;
  border-radius: 18px;
  padding: 16px;
  text-align: center;
}
.card .muted { font-size: 12px; margin-bottom: 6px; }
.stat-num { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.stat-num.green { color: #16a34a; }
.stat-num.red { color: #dc2626; }
.stat-num.yellow { color: #d97706; }

/* ===== Panels ===== */
.top-panels { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }
.panel {
  background: #fff;
  border: 1px solid #e5e5e7;
  border-radius: 18px;
  padding: 16px;
}
.panel-title { font-size: 13px; font-weight: 700; color: #0f172a; margin-bottom: 10px; }
.section { margin-top: 14px; }

/* ===== Table ===== */
.table-wrap { overflow: visible; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 10px 8px; color: #64748b; font-weight: 600; border-bottom: 1px solid #e5e5e7; }
td { padding: 10px 8px; border-bottom: 1px solid #f0f0f2; vertical-align: top; }
tr:hover td { background: #f8fafc; }
.empty { text-align: center; color: #94a3b8; padding: 40px 20px; }

/* ===== Status dot ===== */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.online { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.15); }
.status-dot.offline { background: #ef4444; }

/* ===== Pills ===== */
.pill { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.pill-blue { background: #f3f4f6; color: #6b7280; font-size: 10px; font-weight: 600; }

/* ===== Mono ===== */
.mono { font-family: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace; }

/* ===== Tabs ===== */
.tabs { display: flex; gap: 6px; }
.tab {
  background: transparent;
  border: none;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  font-family: inherit;
}
.tab.active { background: #0f172a; color: #fff; }

/* ===== Views ===== */
.view { display: none; }
.view.active { display: block; }

/* ===== Buttons ===== */
.btn {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn.primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.btn.warn { background: #fef3c7; color: #b45309; border-color: #fde68a; }

/* ===== Split layout ===== */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ===== KV / Overview ===== */
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 13px; }

/* ===== Dark overrides for new classes ===== */
body.dark .card { background: #0f172a; border-color: #223041; }
body.dark .panel { background: #0f172a; border-color: #223041; }
body.dark .tab.active { background: #1d4ed8; color: #fff; }
body.dark th { color: #8ea0b8; border-bottom-color: #223041; }
body.dark td { border-bottom-color: #1e293b; }
body.dark tr:hover td { background: #111827; }
body.dark .btn { background: #132038; color: #e8f0ff; border-color: #2b3545; }
body.dark .btn.primary { background: #1d4ed8; border-color: #1d4ed8; }
body.dark .btn.warn { background: #451a03; color: #fcd34d; border-color: #78350f; }
body.dark .empty { color: #64748b; }

/* ===== Responsive ===== */
@media (max-width: 1080px) {
  .grid.cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .top-panels { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .grid.cards { grid-template-columns: 1fr 1fr; }
  .wrap { padding: 0 14px; }
  .main { padding: 14px 14px 30px; }
}

.refresh-fab {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 9999;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .92);
  color: #0f172a;
  font-size: 12px;
  border: 1px solid #dbe3ef;
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .12);
  backdrop-filter: blur(8px);
}

.refresh-fab:hover { opacity: .82; }

.ss-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  text-align: left;
}

.ss-title { font-size: 32px; font-weight: 700; letter-spacing: -.02em; }

.ss-overall {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid #e5e5e7;
  border-radius: 999px;
  background: #fff;
  color: #1d1d1f;
  font-weight: 600;
}

.ss-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
  color: #64748b;
  font-size: 14px;
}

.ss-meta b { color: #0f172a; font-weight: 700; }

/* Overall progress bar */
.overall-bar-wrap { margin-top: 14px; max-width: 460px; width: 100%; }

.overall-bar {
  height: 12px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
  display: flex;
}

.bar-online { background: #22c55e; transition: width .6s ease; }
.bar-offline { background: #ef4444; transition: width .6s ease; }

.bar-legend {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-top: 8px;
  font-size: 12px;
  color: #64748b;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ===== Main grid ===== */
main { padding: 24px 20px 40px; max-width: 1280px; margin: 0 auto; }

.ss-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-top: 4px;
}

.ss-col {
  background: #fff;
  border: 1px solid #e5e5e7;
  border-radius: 22px;
  padding: 18px 18px 10px;
}

.ss-col-title { font-size: 18px; font-weight: 700; margin-bottom: 10px; }

.ss-col-title .col-count {
  font-size: 12px;
  color: #64748b;
  font-weight: 600;
}

.ss-col-title .col-status {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: middle;
}

.col-status.all-online { background: #dcfce7; color: #16a34a; }
.col-status.some-offline { background: #fee2e2; color: #dc2626; }

.ss-device-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 16px;
}

.ss-device {
  display: flex;
  width: 100%;
  break-inside: avoid;
  border: 0;
  border-top: 1px solid #f0f0f2;
  background: transparent;
  align-items: center;
  gap: 10px;
  padding: 10px 2px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
}

.ss-device:first-of-type { border-top: 0; }
.ss-device:hover { opacity: .82; }

.ss-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex: 0 0 auto;
}

.ss-dot-offline {
  animation: ssOfflineBlink 1.8s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(239, 68, 68, .55);
}

@keyframes ssOfflineBlink {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, .12), 0 0 8px rgba(239, 68, 68, .30);
  }
  50% {
    opacity: .28;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, .10), 0 0 14px rgba(239, 68, 68, .52);
  }
}

.ss-name-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
}

.ss-name {
  font-size: 15px;
  line-height: 1.35;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.ss-name .alias-mark { color: #94a3b8; font-size: .8em; margin-left: 3px; }

.ss-offline-for { font-size: 12px; color: #b91c1c; font-weight: 700; }

.ss-sub-sep { color: #cbd5e1; font-size: 11px; margin: 0 2px; }

.ss-suffix-mini {
  font-size: 10px;
  font-weight: 600;
  color: #6b7280;
  background: #f3f4f6;
  padding: 1px 6px;
  border-radius: 999px;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ss-region-mini {
  font-size: 11px;
  color: #475569;
  background: #f1f5f9;
  padding: 1px 7px;
  border-radius: 999px;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ss-note-tag {
  font-size: 11px;
  color: #64748b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
}

.ss-mon-mini {
  font-size: 11px;
  font-weight: 700;
  color: #7c3aed;
  background: #f5f3ff;
  padding: 1px 7px;
  border-radius: 999px;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== Empty state ===== */
.empty-state {
  text-align: center;
  padding: 64px 20px;
  color: #64748b;
}

.empty-icon { color: #94a3b8; margin-bottom: 16px; }
.empty-state h2 { font-size: 18px; color: #0f172a; margin-bottom: 8px; }
.empty-state p { font-size: 14px; }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, .32);
  backdrop-filter: blur(6px) saturate(150%);
  -webkit-backdrop-filter: blur(6px) saturate(150%);
  animation: fadeIn .18s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  background: #fff;
  border-radius: 24px;
  border: 1px solid #e5e5e7;
  width: 100%;
  max-width: 620px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(15, 23, 42, .18);
  animation: slideUp .22s ease;
  overflow: hidden;
}

@keyframes slideUp { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 14px;
  border-bottom: 1px solid #f0f0f2;
}

.modal-title-wrap { min-width: 0; }

.modal-title { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }

.modal-sub { font-size: 11px; color: #64748b; margin-top: 3px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; line-height: 1.25; }

.modal-close {
  background: #f1f5f9;
  border: none;
  font-size: 20px;
  color: #475569;
  cursor: pointer;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s;
  line-height: 1;
  padding: 0;
}

.modal-close:hover { background: #e2e8f0; }

.modal-body { padding: 18px 24px 24px; overflow-y: auto; }

/* Tabs */
.modal-tabs {
  display: flex;
  gap: 4px;
  background: #f1f5f9;
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 18px;
}

.modal-tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 12px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}

.modal-tab.active {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .1);
}

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* Detail grid (Apple style key-value) */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
  padding: 6px 0;
}

.ss-k { font-size: 12px; color: #64748b; margin-bottom: 4px; }
.ss-v { font-size: 14px; word-break: break-word; overflow-wrap: anywhere; font-weight: 500; }

.ss-v.online-text { color: #16a34a; font-weight: 700; }
.ss-v.offline-text { color: #dc2626; font-weight: 700; }

.offline-periods { grid-column: 1 / -1; margin-bottom: 8px; }
.offline-periods h5 { font-size: 12px; color: #64748b; margin: 0 0 6px; font-weight: 500; }
.offline-period-item { font-size: 13px; color: #dc2626; padding: 3px 0; border-bottom: 1px dashed #e2e8f0; }
.offline-period-item:last-child { border-bottom: none; }

/* Network speed cards */
.net-speed-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }

.net-speed-card {
  background: #f8fafc;
  border: 1px solid #e5e5e7;
  border-radius: 16px;
  padding: 16px;
  text-align: center;
}

.net-speed-label { font-size: 12px; color: #64748b; margin-bottom: 6px; }

.net-speed-value { font-size: 24px; font-weight: 800; letter-spacing: -.02em; color: #0f172a; }

.section-title { font-size: 14px; font-weight: 700; margin: 20px 0 10px; color: #0f172a; }
.section-title.danger { color: #dc2626; }

/* IP history (with checkbox + region + suffix) */
.ip-history { display: flex; flex-direction: column; gap: 0; }

.ss-v-region {
  font-size: 12px;
  color: #64748b;
  font-family: -apple-system, BlinkMacSystemFont, system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-weight: 500;
  margin-top: 2px;
}

/* Monitors block in device detail */
.screen-monitors {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}
.mon-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #f8fafc;
  min-width: 0;
}
.mon-item:first-of-type {
  border-top: 1px solid #e2e8f0;
}
.mon-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.mon-sub {
  padding-left: 28px;
}
.mon-badge {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: #eff6ff;
  color: #2563eb;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mon-name {
  font-size: 13px;
  color: #1e293b;
  font-weight: 600;
  min-width: 0;
  word-break: break-word;
}
.mon-primary {
  font-size: 10px;
  color: #16a34a;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 700;
  margin-left: 4px;
}
.mon-res {
  display: inline-flex;
  font-size: 12px;
  color: #64748b;
  font-family: ui-monospace, Consolas, monospace;
  background: #fff;
  border: 1px solid #e2e8f0;
  padding: 2px 8px;
  border-radius: 6px;
}
.mon-res-empty {
  color: #94a3b8;
}
@media (max-width: 420px) {
  .screen-monitors {
    grid-template-columns: 1fr;
  }
}


.ip-history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-top: 1px solid #f0f0f2;
  font-size: 13px;
  cursor: pointer;
}

.ip-history-item:hover { background: #f8fafc; }

.ip-history-item:first-of-type { border-top: 0; }

.ip-check {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  accent-color: #2563eb;
  cursor: pointer;
}

.ip-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.ip-history-item .ip-addr {
  font-family: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.ip-history-item .ip-current {
  background: #dcfce7;
  color: #16a34a;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: -apple-system, BlinkMacSystemFont, system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.ip-suffix-tag {
  background: #f3f4f6;
  color: #6b7280;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  font-family: -apple-system, BlinkMacSystemFont, system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.ip-first-tag {
  background: #eff6ff;
  color: #2563eb;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  font-family: -apple-system, BlinkMacSystemFont, system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.ip-region { color: #64748b; font-size: 12px; }
.ip-region.unknown { color: #94a3b8; }

.ip-history-item .ip-time {
  color: #94a3b8;
  font-size: 11px;
  text-align: right;
  flex: 0 0 auto;
  line-height: 1.5;
}

/* IP suffix toolbar */
.ip-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #e5e5e7;
  border-radius: 12px;
}

.ip-toolbar-info { font-size: 12px; color: #64748b; font-weight: 600; }

.ip-toolbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

#ip-suffix-input {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  width: 180px;
  font-family: inherit;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}

#ip-suffix-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.btn-sm { padding: 7px 14px !important; font-size: 12px !important; }

.btn-ghost {
  background: #fff;
  color: #475569;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s;
}

.btn-ghost:hover { background: #f1f5f9; }

.loading-text { color: #94a3b8; font-size: 13px; }

/* Timeline: 3 days, hourly cells */
.timeline-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #64748b;
  margin-bottom: 12px;
}

.lg { display: inline-flex; align-items: center; gap: 5px; }

.lg-dot { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.lg-dot.on { background: linear-gradient(180deg, #4ade80, #16a34a); }
.lg-dot.off { background: linear-gradient(180deg, #fda4af, #f87171); }
.lg-dot.nodata { background: #eef2f7; border: 1px solid #e2e8f0; }
.lg-dot.future { background: repeating-linear-gradient(45deg, #f1f5f9, #f1f5f9 2px, #e2e8f0 2px, #e2e8f0 4px); }

.timeline-days { display: flex; flex-direction: column; gap: 10px; }

.tl-day-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px;
  align-items: center;
}

.tl-day-label {
  display: flex;
  flex-direction: column;
  font-size: 11px;
  color: #64748b;
  line-height: 1.5;
  min-width: 0;
}

.tl-day-label b { color: #0f172a; font-size: 12px; white-space: nowrap; }

.tl-cells {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  gap: 2px;
}

.tl-cell {
  height: 18px;
  border-radius: 3px;
  background: #eef2f7;
  cursor: default;
  transition: transform .1s;
}

.tl-cell:hover { transform: scale(1.25); }

.tl-cell.on { background: linear-gradient(180deg, #4ade80, #16a34a); }
.tl-cell.off { background: linear-gradient(180deg, #fda4af, #f87171); }
.tl-cell.nodata { background: #eef2f7; }
.tl-cell.future { background: repeating-linear-gradient(45deg, #f8fafc, #f8fafc 3px, #e2e8f0 3px, #e2e8f0 6px); }

.tl-hour-scale {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #94a3b8;
  margin-top: 4px;
  margin-left: 130px;
}

/* Edit form */
.edit-form { display: flex; flex-direction: column; gap: 16px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-group label { font-size: 13px; font-weight: 600; color: #0f172a; }

.form-hint { font-weight: 400; color: #94a3b8; font-size: 12px; }

.form-group input,
.form-group textarea {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  background: #f8fafc;
  transition: border-color .15s, background .15s;
  resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #2563eb;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.btn-primary {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s;
  align-self: flex-start;
}

.btn-primary:hover { background: #1d4ed8; }
.btn-primary:disabled { background: #93c5fd; cursor: default; }

.save-status { font-size: 13px; color: #16a34a; font-weight: 600; margin-left: 10px; }

/* Danger zone */
.danger-zone {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid #f0f0f2;
}

.danger-desc { font-size: 13px; color: #64748b; margin: 0 0 12px; }

.btn-danger {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}

.btn-danger:hover { background: #dc2626; color: #fff; border-color: #dc2626; }

/* ===== Responsive ===== */
@media (max-width: 1080px) {
  .ss-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .ss-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ss-title { font-size: 26px; }
}

@media (max-width: 560px) {
  .ss-grid { grid-template-columns: 1fr; }
  .ss-device-grid { grid-template-columns: 1fr; }
  .ss-title { font-size: 22px; }
  .modal-card { max-height: calc(100vh - 24px); border-radius: 18px; }
  /* 设备详情弹窗的「总览」网格：保留 2 列（每列约 160px，足够显示中文+数字），
     避免 16 个字段全部纵向一列要拖动很久。
     此处不要改 1fr——之前在这里 1fr 是导致用户抱怨"拖动好多东西"的根因。 */
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; }
  .net-speed-row { grid-template-columns: 1fr; }
  .tl-day-row { grid-template-columns: 86px 1fr; }
  .tl-day-label b { font-size: 11px; white-space: normal; }
  .tl-cell { height: 14px; }
  .tl-hour-scale { margin-left: 96px; }
  .ip-toolbar { flex-direction: column; align-items: stretch; }
  .ip-toolbar-actions { width: 100%; }
  #ip-suffix-input { flex: 1; width: auto; }
}

/* ===== Hardware ===== */
.hardware-disks { display: flex; flex-direction: column; gap: 12px; }

.disk-list { display: flex; flex-direction: column; gap: 12px; }

.disk-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.disk-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
}

.disk-drive {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.disk-drive::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3C/svg%3E") center/contain no-repeat;
}

.disk-size { color: #64748b; font-weight: 500; font-size: 13px; }

.disk-bar-wrap {
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.disk-bar { height: 100%; border-radius: 999px; transition: width .4s ease; }

.disk-footer {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #64748b;
}

body.dark .disk-item { background: #0f172a; border-color: #223041; }
body.dark .disk-bar-wrap { background: #1e293b; }

/* Scrollbar */
.modal-body::-webkit-scrollbar { width: 8px; }
.modal-body::-webkit-scrollbar-thumb { background: #d3d9e3; border-radius: 4px; }
.modal-body::-webkit-scrollbar-track { background: transparent; }

/* ===== Login Page ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: #f5f7fb;
}

.login-card {
  background: #fff;
  border-radius: 22px;
  padding: 36px 32px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 4px 24px rgba(15, 23, 42, .06);
  text-align: center;
}

.login-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  background: #f0f7ff;
  border-radius: 18px;
  margin-bottom: 16px;
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 6px;
  color: #0f172a;
}

.login-subtitle {
  font-size: 14px;
  color: #64748b;
  margin: 0 0 24px;
}

.login-form { display: flex; flex-direction: column; gap: 14px; text-align: left; }

.login-form .form-group { gap: 5px; }

.login-form .form-group label { font-size: 13px; font-weight: 600; color: #0f172a; }

.login-form .form-group input {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 14px;
  font-family: inherit;
  background: #f8fafc;
  transition: border-color .15s, background .15s;
  width: 100%;
}

.login-form .form-group input:focus {
  outline: none;
  border-color: #2563eb;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.login-remember {
  font-size: 13px;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 6px;
}

.login-remember input { accent-color: #2563eb; }

.login-btn {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s;
  margin-top: 4px;
}

.login-btn:hover { background: #1d4ed8; }
.login-btn:disabled { background: #93c5fd; cursor: default; }

.login-error {
  font-size: 13px;
  color: #dc2626;
  font-weight: 600;
  text-align: center;
  min-height: 18px;
}

/* 登录页语言选择 */
.login-lang {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #eef2f8;
  display: flex;
  justify-content: center;
}
body.dark .login-lang { border-top-color: #223041; }
.login-lang-select {
  width: 100%;
  max-width: 220px;
  padding: 9px 12px;
  font-size: 13px;
  text-align: center;
}

/* ===== User Menu ===== */
.user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #475569;
}

.btn-logout {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s;
}

.btn-logout:hover { background: #e2e8f0; }

/* ===== Theme toggle button ===== */
.theme-toggle {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  width: 34px;
  height: 34px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, transform .15s;
  flex: 0 0 auto;
  line-height: 1;
  padding: 0;
}
.theme-toggle:hover { background: #e2e8f0; transform: scale(1.06); }

/* ============================================================
   Dark theme (参考 check.heytee.top 备份站配色)
   ============================================================ */
body.dark { color-scheme: dark; }
body.dark {
  background: linear-gradient(180deg, #06101d, #0b1220);
  color: #e5eefb;
}

/* Header */
body.dark header {
  background: rgba(7, 17, 31, .92);
  border-bottom-color: #223041;
}
body.dark .ss-title { color: #e5eefb; }
body.dark .ss-meta { color: #8ea0b8; }
body.dark .ss-meta b { color: #e5eefb; }

/* Overall pill + bar */
body.dark .ss-overall {
  background: #0f172a;
  border-color: #223041;
  color: #e8f0ff;
}
body.dark .overall-bar { background: #1e293b; }
body.dark .bar-legend { color: #8ea0b8; }

/* Columns / cards */
body.dark .ss-col {
  background: linear-gradient(180deg, rgba(15,23,42,.96), rgba(15,23,42,.9));
  border-color: #223041;
}
body.dark .ss-col-title { color: #e5eefb; }
body.dark .ss-col-title .col-count { color: #8ea0b8; }
body.dark .col-status.all-online { background: #073b1e; color: #bbf7d0; }
body.dark .col-status.some-offline { background: #3b0b0b; color: #fecaca; }

/* Device rows */
body.dark .ss-device { border-top-color: #223041; color: #e5eefb; }
body.dark .ss-name { color: #e5eefb; }
body.dark .ss-name .alias-mark { color: #64748b; }
body.dark .ss-sub-sep { color: #475569; }
body.dark .ss-offline-for { color: #f87171; }
body.dark .ss-suffix-mini { background: #1f2937; color: #9ca3af; }
body.dark .ss-region-mini { background: #172033; color: #bfd3ef; }
body.dark .ss-note-tag { color: #8ea0b8; }
body.dark .ss-mon-mini { background: #2a1a4a; color: #c4b5fd; }

/* Empty state */
body.dark .empty-state { color: #8ea0b8; }
body.dark .empty-state h2 { color: #e5eefb; }

/* Modal */
body.dark .modal-card {
  background: #0f172a;
  border-color: #223041;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .5);
}
body.dark .modal-header { border-bottom-color: #223041; }
body.dark .modal-title { color: #e5eefb; }
body.dark .modal-sub { color: #8ea0b8; }
body.dark .modal-close { background: #1e293b; color: #bfd3ef; }
body.dark .modal-close:hover { background: #2b3545; }
body.dark .modal-tabs { background: #111827; }
body.dark .modal-tab { color: #8ea0b8; }
body.dark .modal-tab.active { background: #1d4ed8; color: #fff; box-shadow: none; }

/* Detail grid */
body.dark .ss-k { color: #8ea0b8; }
body.dark .ss-v { color: #e5eefb; }
body.dark .ss-v-region { color: #8ea0b8; }
body.dark .section-title { color: #e5eefb; }
body.dark .offline-periods h5 { color: #8ea0b8; }
body.dark .offline-period-item { color: #f87171; border-bottom-color: #2b3545; }

/* Network speed cards */
body.dark .net-speed-card { background: #111827; border-color: #223041; }
body.dark .net-speed-label { color: #8ea0b8; }
body.dark .net-speed-value { color: #e5eefb; }

/* Monitors block */
body.dark .mon-item { border-color: #223041; background: #111827; }
body.dark .mon-badge { background: #172554; color: #bfdbfe; }
body.dark .mon-name { color: #e5eefb; }
body.dark .mon-primary { background: #073b1e; color: #bbf7d0; border-color: #14532d; }
body.dark .mon-res { background: #0f172a; color: #8ea0b8; border-color: #223041; }

/* IP history */
body.dark .ip-history-item { border-top-color: #223041; }
body.dark .ip-history-item:hover { background: #111827; }
body.dark .ip-history-item .ip-addr { color: #e5eefb; }
body.dark .ip-history-item .ip-current { background: #073b1e; color: #bbf7d0; }
body.dark .ip-suffix-tag { background: #1f2937; color: #9ca3af; }
body.dark .ip-first-tag { background: #172554; color: #93c5fd; }
body.dark .ip-region { color: #8ea0b8; }
body.dark .ip-toolbar { background: #111827; border-color: #223041; }
body.dark .ip-toolbar-info { color: #8ea0b8; }
body.dark #ip-suffix-input { background: #0b1526; border-color: #2b3545; color: #e5eefb; }

/* Buttons */
body.dark .btn-ghost { background: #132038; color: #e8f0ff; border-color: #2b3545; }
body.dark .btn-ghost:hover { background: #1c2a45; }
body.dark .btn-danger { background: #3b0b0b; color: #fecaca; border-color: #7f1d1d; }
body.dark .btn-danger:hover { background: #dc2626; color: #fff; }
body.dark .btn-logout { background: #132038; color: #e8f0ff; border-color: #2b3545; }
body.dark .btn-logout:hover { background: #1c2a45; }
body.dark .theme-toggle { background: #132038; color: #e8f0ff; border-color: #2b3545; }
body.dark .theme-toggle:hover { background: #1c2a45; }
body.dark .user-menu { color: #bfd3ef; }

/* Timeline */
body.dark .timeline-legend { color: #8ea0b8; }
body.dark .tl-day-label { color: #8ea0b8; }
body.dark .tl-day-label b { color: #e5eefb; }
body.dark .tl-cell { background: #1e293b; }
body.dark .tl-cell.on { background: linear-gradient(180deg, #22c55e, #15803d); }
body.dark .tl-cell.off { background: linear-gradient(180deg, #ef4444, #b91c1c); }
body.dark .tl-cell.nodata { background: #1e293b; }
body.dark .tl-cell.future { background: repeating-linear-gradient(45deg, #111827, #111827 3px, #1e293b 3px, #1e293b 6px); }
body.dark .lg-dot.nodata { background: #1e293b; border-color: #2b3545; }
body.dark .lg-dot.future { background: repeating-linear-gradient(45deg, #111827, #111827 2px, #1e293b 2px, #1e293b 4px); }
body.dark .tl-hour-scale { color: #64748b; }

/* Edit form */
body.dark .form-group label { color: #e5eefb; }
body.dark .form-group input,
body.dark .form-group textarea {
  background: #0b1526;
  border-color: #2b3545;
  color: #e5eefb;
}
body.dark .form-group input:focus,
body.dark .form-group textarea:focus { background: #0f1a2e; }
body.dark .danger-zone { border-top-color: #223041; }
body.dark .danger-desc { color: #8ea0b8; }
body.dark .loading-text { color: #64748b; }

/* Refresh fab */
body.dark .refresh-fab {
  background: rgba(15, 23, 42, .92);
  color: #e5eefb;
  border-color: #2b3545;
}

/* Scrollbar */
body.dark .modal-body::-webkit-scrollbar-thumb { background: #2b3545; }

/* Login page */
body.dark .login-page { background: linear-gradient(180deg, #06101d, #0b1220); }
body.dark .login-card { background: #0f172a; border: 1px solid #223041; }
body.dark .login-logo { background: #172033; }
body.dark .login-title { color: #e5eefb; }
body.dark .login-subtitle { color: #8ea0b8; }
body.dark .login-form .form-group label { color: #e5eefb; }
body.dark .login-form .form-group input { background: #0b1526; border-color: #2b3545; color: #e5eefb; }
body.dark .login-form .form-group input:focus { background: #0f1a2e; }
body.dark .login-remember { color: #bfd3ef; }

/* ============================================================
   Power events log
   ============================================================ */
.power-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
  font-size: 12px;
  color: #475569;
}
.lg-dot.pw-boot { background: #22c55e; }
.lg-dot.pw-shutdown { background: #ef4444; }
.lg-dot.pw-suspend { background: #f59e0b; }
.lg-dot.pw-resume { background: #3b82f6; }
.lg-dot.pw-agent { background: #8b5cf6; }

.power-events-list {
  max-height: 380px;
  overflow-y: auto;
}

.pw-event {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid #f1f5f9;
  font-size: 13px;
}
.pw-event:first-child { border-top: none; }

.pw-icon {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 4px;
  flex: 0 0 auto;
}
.pw-icon.boot { background: #22c55e; }
.pw-icon.shutdown { background: #ef4444; }
.pw-icon.suspend { background: #f59e0b; }
.pw-icon.resume { background: #3b82f6; }
.pw-icon.agent_start { background: #8b5cf6; }
.pw-icon.agent_stop { background: #64748b; }
.pw-icon.default { background: #94a3b8; }

.pw-body { flex: 1; min-width: 0; }
.pw-time {
  font-size: 11px;
 color: #64748b; font-size: 12px; margin-bottom: 2px; }
.pw-label {
  font-size: 11px;
 font-weight: 600; color: #1e293b; }
.pw-reason {
  font-size: 10px;
 color: #64748b; font-size: 12px; margin-top: 1px; }

body.dark .pw-event { border-top-color: #223041; }
body.dark .pw-time {
  font-size: 11px;
 color: #8ea0b8; }

/* ============================================================
   Device management: IP groups + compact grid
   ============================================================ */
#group-panels {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  align-items: start;
}
.group-block {
  margin-bottom: 0;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  background: #fff;
}
.group-title {
  font-weight: 700;
  font-size: 13px;
  color: #334155;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.group-count { color: #64748b; font-weight: 500; }
.group-device-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.dev-check-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  cursor: pointer;
  font-size: 12px;
}
.dev-check-card:hover { background: #f1f5f9; }
.dev-check-card input { cursor: pointer; }
.dev-check-card-main {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.dev-check-card-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.dev-check-card-mac {
  color: #94a3b8;
  font-size: 10px;
  text-align: right;
}

body.dark .group-block { background: #0f172a; border-color: #223041; }
body.dark .group-title { color: #e5eefb; }
body.dark .group-count { color: #8ea0b8; }
body.dark .dev-check-card { background: #111827; border-color: #223041; color: #e5eefb; }
body.dark .dev-check-card:hover { background: #1e293b; }
body.dark .dev-check-card-mac { color: #64748b; }

@media (max-width: 1200px) {
  #group-panels { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .group-device-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 420px) {
  .group-device-grid { grid-template-columns: 1fr; }
}

/* Table row device name link */
.row-device-name { color: #2563eb; text-decoration: none; font-weight: 600; display:inline-flex; align-items:center; justify-content:center; gap:6px; text-align:center; }
.row-device-name:hover { text-decoration: underline; }
body.dark .row-device-name { color: #60a5fa; }

/* Small button */
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 10px; }
.btn-clear { background:#f1f5f9; color:#475569; border-color:#e2e8f0; }
body.dark .btn-clear { background:#1e293b; color:#94a3b8; border-color:#334155; }
body.dark .pw-label {
  font-size: 11px;
 color: #e5eefb; }
body.dark .pw-reason {
  font-size: 10px;
 color: #8ea0b8; }

/* ============================================================
   TikTok Live badge + sessions
   ============================================================ */
.live-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  background: #22c55e;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 0 7px;
  border-radius: 999px;
  vertical-align: middle;
  animation: livePulse 1.4s ease-in-out infinite;
}
body.dark .live-count-badge { background: #22c55e; color: #fff; }

.day-count-label { color: #64748b; font-size: 13px; font-weight: 500; }
.day-count-badge {
  display: inline-block;
  color: #334155;
  font-size: 14px;
  font-weight: 700;
  min-width: 14px;
  text-align: center;
}
body.dark .day-count-label { color: #94a3b8; }
body.dark .day-count-badge { color: #e2e8f0; }
.live-room-ended-tag {
  color: #64748b;
  font-size: 10px;
  font-weight: 600;
  background: #f1f5f9;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  white-space: nowrap;
}
body.dark .live-room-ended-tag { background: #1e293b; color: #94a3b8; border-color: #334155; }
/* 「最近结束」里标记该设备结束上一场后又开了新的一场 */
.live-room-relive-tag {
  color: #b45309;
  font-size: 10px;
  font-weight: 600;
  background: #fef3c7;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid #fde68a;
  white-space: nowrap;
}
body.dark .live-room-relive-tag { background: #422c0b; color: #fbbf24; border-color: #78350f; }
.live-timeline-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 12px;
  margin-bottom: 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
.live-timeline-chips::-webkit-scrollbar { height: 6px; }
.live-timeline-chips::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; }
.live-timeline-chips::-webkit-scrollbar-track { background: transparent; }
.live-timeline-chip {
  flex: 0 0 auto;
  white-space: nowrap;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background .15s, border-color .15s, color .15s;
}
.live-timeline-chip:hover { border-color: #94a3b8; }
.live-timeline-chip.active { background: #22c55e; color: #fff; border-color: #22c55e; }
.live-timeline-chip-count {
  background: rgba(0,0,0,0.08);
  color: inherit;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
}
.live-timeline-chip.active .live-timeline-chip-count { background: rgba(255,255,255,0.28); }
body.dark .live-timeline-chip { background: #1e293b; color: #cbd5e1; border-color: #334155; }
body.dark .live-timeline-chip:hover { border-color: #475569; }
body.dark .live-timeline-chip.active { background: #22c55e; color: #fff; border-color: #22c55e; }
body.dark .live-timeline-chips::-webkit-scrollbar-thumb { background: #334155; }

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: #16a34a;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid #22c55e;
  animation: livePulse 1.4s ease-in-out infinite;
  text-shadow: 0 0 8px rgba(57, 255, 20, 0.6);
  box-shadow: 0 0 10px rgba(57, 255, 20, 0.2), inset 0 0 4px rgba(57, 255, 20, 0.08);
  vertical-align: middle;
  margin-left: 4px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.live-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  animation: liveDot 1.4s ease-in-out infinite;
  box-shadow: 0 0 6px #22c55e;
  display: inline-block;
  vertical-align: middle;
  margin-right: 2px;
}

@keyframes livePulse {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 10px rgba(57, 255, 20, 0.2), inset 0 0 4px rgba(57, 255, 20, 0.08);
    text-shadow: 0 0 8px rgba(57, 255, 20, 0.6);
  }
  50% {
    opacity: 0.88;
    box-shadow: 0 0 22px rgba(57, 255, 20, 0.5), inset 0 0 10px rgba(57, 255, 20, 0.18);
    text-shadow: 0 0 16px rgba(57, 255, 20, 0.9), 0 0 28px rgba(57, 255, 20, 0.35);
  }
}

@keyframes liveDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.5); opacity: 0.6; }
}

/* Monitor icon with count number */
.monitor-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 22px;
  height: 22px;
  vertical-align: middle;
  margin-left: 2px;
}
.monitor-icon svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 22px;
  height: 22px;
  color: #64748b;
}
.monitor-icon-num {
  position: absolute;
  z-index: 1;
  top: 5px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 9px;
  font-weight: 700;
  color: #475569;
  line-height: 1;
}
body.dark .monitor-icon svg { color: #8ea0b8; }
body.dark .monitor-icon-num { color: #cbd5e1; }

/* Status cell stack (default theme table) */
.status-cell-stack {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.apple-dev-mon .monitor-icon { margin-left: 0; }
.apple-dev-mon .monitor-icon svg { color: inherit; opacity: 0.7; }
.apple-dev-mon .monitor-icon-num { color: inherit; opacity: 0.9; }

/* Status cell wrapper ("状况" column) */
.status-cell-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Live status cards in modal */
.live-status-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.live-status-card {
  background: #f8fafc;
  border: 1px solid #e5e5e7;
  border-radius: 16px;
  padding: 16px;
  text-align: center;
}

.live-status-label { font-size: 12px; color: #64748b; margin-bottom: 6px; }
.live-status-value { font-size: 18px; font-weight: 700; color: #0f172a; }

/* Live sessions list */
.live-sessions-list {
  max-height: 320px;
  overflow-y: auto;
}

.live-session-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid #f1f5f9;
  font-size: 13px;
}
.live-session-item:first-child { border-top: none; }

.live-session-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #39ff14;
  margin-top: 4px;
  flex: 0 0 auto;
  box-shadow: 0 0 6px #39ff14;
}

.live-session-body { flex: 1; min-width: 0; }
.live-session-time { font-weight: 600; color: #1e293b; }
.live-session-dur { color: #64748b; font-size: 12px; margin-top: 2px; }

/* 云手机使用时段：与直播段合并展示在同一时间线，用青色区分（取色同「云手机使用中」） */
.live-session-dot.cp {
  background: #06b6d4;
  box-shadow: 0 0 6px rgba(6, 182, 212, .8);
}
.cp-session-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: #06b6d4;
  background: rgba(34, 211, 238, .12);
  border: 1px solid rgba(34, 211, 238, .35);
  border-radius: 999px;
  padding: 0 6px;
  margin-right: 4px;
  vertical-align: 1px;
}
.live-now-text { color: #16a34a; font-weight: 700; }
.live-now-text.cp { color: #06b6d4; }

/* Dark theme */
body.dark .live-badge {
  background: transparent;
  border-color: #4ade80;
  color: #4ade80;
}
body.dark .live-status-card { background: #111827; border-color: #223041; }
body.dark .live-status-label { color: #8ea0b8; }
body.dark .live-status-value { color: #e5eefb; }
body.dark .live-session-item { border-top-color: #223041; }
body.dark .live-session-time { color: #e5eefb; }
body.dark .live-session-dur { color: #8ea0b8; }
body.dark .live-session-dot.cp { background: #67e8f9; box-shadow: 0 0 6px rgba(103, 232, 249, .8); }
body.dark .cp-session-tag { color: #67e8f9; background: rgba(103, 232, 249, .12); border-color: rgba(103, 232, 249, .3); }
body.dark .live-now-text { color: #4ade80; }
body.dark .live-now-text.cp { color: #67e8f9; }

/* Responsive */
@media (max-width: 560px) {
  .live-status-row { grid-template-columns: 1fr; }
}



.theme-select {
  background: #fff;
  color: #0f172a;
  border: 1px solid #dbe3ef;
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
}
body.dark .theme-select {
  background: #132038;
  color: #e8f0ff;
  border-color: #2b3545;
}
.lang-select {
  background: #fff;
  color: #0f172a;
  border: 1px solid #dbe3ef;
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
  max-width: 168px;
}
body.dark .lang-select {
  background: #132038;
  color: #e8f0ff;
  border-color: #2b3545;
}
.view-toggle {
  display: none;
  gap: 4px;
  align-items: center;
  background: #fff;
  border: 1px solid #dbe3ef;
  border-radius: 10px;
  padding: 3px;
}
.view-toggle button {
  border: 0;
  background: transparent;
  color: #0f172a;
  font: inherit;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
}
.view-toggle button.active { background: #3b82f6; color: #fff; }
body.dark .view-toggle { background: #132038; border-color: #2b3545; }
body.dark .view-toggle button { color: #e8f0ff; }
body.dark .view-toggle button.active { background: #3b82f6; color: #fff; }
@media (min-width: 641px) and (pointer: coarse) {
  .view-toggle { display: inline-flex; }
  .btn-logout { display: none; }
}
/* Heatmap tap tooltip (mobile has no hover) */
#heat-tip {
  position: fixed;
  z-index: 9999;
  display: none;
  background: #0f172a;
  color: #fff;
  font-size: 12px;
  line-height: 1.45;
  padding: 6px 10px;
  border-radius: 9px;
  max-width: 72vw;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  pointer-events: none;
  white-space: normal;
  word-break: break-word;
}
body.dark #heat-tip { background: #0f172a; color: #e8f0ff; border: 1px solid #2b3545; }
@media (hover: none) {
  .speed-slot, .live-slot { cursor: pointer; }
  .speed-slot:active, .live-slot:active { outline: 2px solid #3b82f6; outline-offset: 1px; }
}
.apple-dashboard {
  margin-top: 14px;
}
.apple-hero, .apple-group-card {
  background: linear-gradient(180deg, rgba(255,255,255,.88), rgba(255,255,255,.98));
  border: 1px solid #e5e7eb;
  border-radius: 24px;
  padding: 18px;
  box-shadow: 0 12px 40px rgba(15,23,42,.08);
  /* 防止网格/弹性子项默认 min-width:auto 撑破视口（设备名 nowrap 时） */
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  overflow-wrap: break-word;
}
.apple-hero-top, .apple-group-head, .group-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.apple-hero-title { font-size: 28px; font-weight: 800; letter-spacing: -.03em; }
.apple-hero-sub, .apple-group-meta, .apple-progress-legend, .apple-dev-sub, .nav-card span { color: #64748b; font-size: 13px; }
.apple-overall-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px;
  background: #f8fafc; border: 1px solid #e2e8f0; font-weight: 700;
}
.apple-meta-row, .apple-progress-legend {
  display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px;
}
.apple-progress { margin-top: 14px; height: 10px; background: #e5e7eb; border-radius: 999px; overflow: hidden; display:flex; }
.apple-progress-on { background: #22c55e; }
.apple-progress-off { background: #ef4444; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; display:inline-block; margin-right:6px; }
.legend-dot.on { background:#22c55e; }
.legend-dot.off { background:#ef4444; }
.live-legend-item { display:inline-flex; align-items:center; gap:6px; color:#22c55e; font-weight:600; }
body.dark .live-legend-item { color:#4ade80; }
.prep-legend-item { display:inline-flex; align-items:center; gap:6px; color:#f97316; font-weight:600; }
body.dark .prep-legend-item { color:#fb923c; }
.prep-bottom-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f97316;
  animation: prepDot 1s ease-in-out infinite;
  box-shadow: 0 0 6px #f97316;
}
body.dark .prep-bottom-dot { background: #fb923c; box-shadow: 0 0 6px #fb923c; }
.apple-group-grid, .nav-grid {
  display: grid; gap: 14px; margin-top: 14px;
}
.nav-grid { grid-template-columns: repeat(4, 1fr); }
/* 多列布局（而非 grid）：设备按「竖向」排列 —— 先填满第一列再往右，
   无需预先知道设备数量，浏览器自动按内容平衡各列高度。 */
.apple-dev-grid {
  columns: 4;
  column-gap: 10px;
  margin-top: 10px;
}
.apple-dev-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px;
  border: none;
  border-radius: 6px;
  background: transparent;
  text-align: left;
  font: inherit;
  cursor: pointer;
  min-height: 0;
  white-space: nowrap;
  overflow: hidden;
  /* 多列布局：单个设备条目不允许被拆到两列 */
  width: 100%;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
}
.apple-dev-item:hover { background: rgba(0,0,0,.04); }
.apple-dev-idx { display: none; }
.apple-dev-text { display:flex; align-items:center; gap:2px; min-width:0; overflow:hidden; }
/* 分组占满整行后单格很宽（~350px），字号保持原大小即可完整显示 */
.apple-dev-name { font-weight: 700; font-size: 13px; color: #0f172a; white-space: nowrap; }
.apple-dev-suffix { font-size: 12px; color: #94a3b8; white-space: nowrap; }
.apple-dev-offline { font-size: 11px; color: #be123c; margin-left: 4px; white-space: nowrap; }
.apple-icon-live { width: 14px; height: 14px; color: #22c55e; flex-shrink:0; animation: appleIconBlink 1.3s ease-in-out infinite; }
.apple-icon-screen-alert { width: 14px; height: 14px; color: #ef4444; flex-shrink:0; }
@keyframes appleIconBlink { 0%,100%{opacity:1} 50%{opacity:.25} }
body.dark .apple-dev-name { color: #e2e8f0; }
body.dark .apple-dev-suffix { color: #64748b; }
body.dark .apple-dev-offline { color: #fda4af; }
body.dark .apple-icon-live { color: #4ade80; }

/* 首页「放送中」指示器：点击跳转到该设备详情的 Live */
.apple-live-trigger { cursor: pointer; display: inline-flex; align-items: center; padding: 2px; margin: -2px -2px -2px 2px; border-radius: 6px; }
.apple-live-trigger:hover { background: rgba(34,197,94,0.16); }
.apple-live-dur {
  color: #16a34a; font-size: 9px; font-weight: 700; line-height: 1;
  margin-left: 2px; white-space: nowrap; flex-shrink: 0;
}
body.dark .apple-live-dur { color: #4ade80; }
.live-badge-live { cursor: pointer; }
.live-badge-live:hover { filter: brightness(1.1); text-decoration: underline; }
.minimal-rec-frame[data-minimal-live] { cursor: pointer; border-radius: 8px; }
.minimal-rec-frame[data-minimal-live]:hover { background: rgba(34,197,94,0.14); }
body.dark .apple-icon-screen-alert { color: #f87171; }
body.dark .apple-dev-item:hover { background: rgba(255,255,255,.05); }
.apple-dev-offline { font-size: 11px; color: #be123c; font-weight: 700; }
.apple-dev-stack { display:flex; flex-direction:column; gap:4px; min-width:0; flex:1; }
.apple-dev-name { font-weight: 700; }
.apple-dev-state { font-size: 12px; font-weight: 700; color: #475569; }
.dev-suffix { font-size: 10px; font-weight: 600; color: #6b7280; background:#f3f4f6; padding:1px 6px; border-radius:999px; }
.dev-note { font-size: 10px; font-weight: 600; color: #2563eb; background:#eff6ff; padding:1px 6px; border-radius:999px; margin-left:2px; }
body.dark .dev-note { background:#1e3a5f; color:#93c5fd; }
/* 直播时间段/实时网速 设备名：绝对在一行（设备名 + 后缀 + 用户 + 红色昵称） */
/* 设备名行：固定在设备列宽内、单行；超长整体省略，避免溢出压到首个热力图方块 */
.dev-name-line { white-space: nowrap; display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.dev-homepage-nick { font-size: 9px; font-weight: 700; color: #fe2c55; background:#fff0f3; padding:1px 6px; border-radius:999px; margin-left:2px; vertical-align: bottom; }
body.dark .dev-homepage-nick { background:#3a1620; color:#ff7a98; }
/* 位置页说明：机柜层编号含义提示（底层=1 中层=2 上层=3），红色突出；
   word-spacing 拉开各项间隔（HTML 连续空格会被折叠，只能靠 CSS），便于分清三项 */
.md-hint-red { color:#fe2c55; font-weight:600; margin-right:8px; word-spacing:12px; }
body.dark .md-hint-red { color:#ff7a98; }

/* OS column color levels */
.os-name { color: #3b82f6; font-weight: 600; }
.uptime-badge { font-weight: 700; }
.uptime-green { color: #16a34a; }
.uptime-purple { color: #9333ea; }
.uptime-orange { color: #f59e0b; }
.uptime-red { color: #ef4444; }
.uptime-blink { animation: uptimeBlink 1.2s ease-in-out infinite; }
@keyframes uptimeBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
body.dark .os-name { color: #60a5fa; }
body.dark .uptime-green { color: #4ade80; }
body.dark .uptime-purple { color: #c084fc; }
body.dark .uptime-orange { color: #fbbf24; }
body.dark .uptime-red { color: #f87171; }

.nav-card {
  border: 1px solid #e5e7eb; background: #fff; border-radius: 18px; padding: 18px; text-align:left; cursor:pointer; font:inherit;
  display:flex; flex-direction:column; gap:8px;
}
.nav-card.static { cursor: default; }
.nav-card strong { font-size: 17px; }
.ip-group-block { border-left: 3px solid #2563eb; padding-left: 12px; }
body.apple-theme .panel, body.apple-theme .card {
  border-radius: 24px;
  box-shadow: 0 16px 40px rgba(15,23,42,.06);
}
body.apple-theme {
  background: linear-gradient(180deg, #f4f7fb 0%, #eef4ff 100%);
}
body.dark.apple-theme {
  background: linear-gradient(180deg, #020617 0%, #0f172a 100%);
}
body.dark .apple-hero, body.dark .apple-group-card, body.dark .nav-card {
  background: rgba(15,23,42,.88); border-color:#223041; box-shadow:none;
}
body.dark .apple-overall-pill { background:#132038; border-color:#2b3545; color:#e8f0ff; }
body.dark .dev-suffix { background:#1f2937; color:#9ca3af; }

#stat-cards, .top-panels { display: none !important; }
.dashboard-filters-panel { margin-top: 14px; }
#dashboard-table-wrap { margin-top: 14px; }
body:not(.apple-theme) .apple-dashboard .apple-group-grid { display: none; }
body:not(.apple-theme) .apple-hero {
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(248,250,252,.98));
}
body.dark:not(.apple-theme) .apple-hero {
  background: rgba(15,23,42,.92);
  border-color: #223041;
  box-shadow: none;
}

.live-badge-apple { margin-left: 2px; }
.apple-dev-sub .live-badge-apple { vertical-align: middle; }

.screen-alert-badge {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 2px 5px;
  border-radius: 999px;
  background: #fff1f2;
  color: #be123c;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.15;
  vertical-align: middle;
}
.toggle-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Screen block in modal */
.screen-block {
  overflow: visible;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.screen-header {
  font-weight: 700;
  font-size: 14px;
  color: #0f172a;
}
.screen-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}
.screen-alert-summary {
  font-size: 13px;
  color: #be123c;
  display: flex;
  align-items: center;
  gap: 8px;
}
.screen-alert-reasons {
  font-weight: 600;
}
.screen-ok-summary {
  font-size: 13px;
  color: #16a34a;
  font-weight: 600;
}
body.dark .screen-header { color: #e5eefb; }
body.dark .screen-toggles { background: #111827; border-color: #223041; }
body.dark .screen-alert-summary { color: #fda4af; }
body.dark .screen-ok-summary { color: #bbf7d0; }

/* Apple theme device card screen line */
.apple-dev-mon {
  font-size: 12px;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}
.apple-dev-mon.alert {
  color: #be123c;
}
.apple-dev-mon.alert .apple-mon-text {
  font-weight: 600;
}
body.dark .apple-dev-mon {
  color: #8ea0b8;
}
body.dark .apple-dev-mon.alert {
  color: #fda4af;
}

/* Live cam badge (recorder icon only, no border, no text) */
.live-cam-badge {
  display: inline-flex;
  align-items: center;
  background: transparent;
  color: #22c55e;
  line-height: 1;
  padding: 0;
  border: none;
}
.live-cam-badge svg {
  width: 14px;
  height: 14px;
  color: #22c55e;
  animation: liveBlink 1.4s ease-in-out infinite;
}
.live-cam-text { display: none; }
@keyframes liveBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.apple-dev-item .status-dot {
  flex-shrink: 0;
  width: 7px;
  height: 7px;
}
body.dark .screen-alert-badge {
  background:#3f0d19;
  color:#fda4af;
}

/* Live bottom bar (broadcasting count at bottom of dashboard) */
.live-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid #22c55e;
  background: transparent;
  color: #22c55e;
  font-size: 13px;
  font-weight: 600;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}
.live-bottom-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  animation: liveBlink 1.2s ease-in-out infinite;
}
body.dark .live-bottom-bar {
  border-color: #22c55e;
  color: #22c55e;
}
body.dark .live-bottom-dot {
  background: #22c55e;
}
/* 分组卡片在所有宽度下都是 1 列（占满整行），故不再需要分档改列数 */
@media (max-width: 640px) {
  /* 手机端：一个分组占满整行，区域内 3 列设备。
     相比原来的「2 分组 × 2 列」，每行设备数从 4 减到 3，
     单格宽度从 ~73px 增到 ~110px，避免设备名/后缀挤压换行。 */
  /* 全部方块（hero / 分组卡 / 设备栏）统一锁到视口宽度，避免任何方块超出画面；
     同时让「其他方块」与「设备栏」等宽对齐。 */
  .apple-dashboard { max-width: 100%; overflow-x: hidden; }
  .apple-hero, .apple-group-card { max-width: 100%; min-width: 0; }
  .apple-group-grid { grid-template-columns: 1fr; min-width: 0; }
  .apple-dev-grid { columns: 3; column-gap: 6px; min-width: 0; }
  .apple-dev-item { gap: 4px; padding: 3px 2px; }
  .apple-dev-name { font-size: 11px; }
  .apple-dev-suffix { font-size: 10px; }
  .apple-dev-offline { font-size: 9px; margin-left: 2px; }
  .apple-icon-live, .apple-icon-screen-alert { width: 12px; height: 12px; }
}
@media (max-width: 420px) {
  .apple-dev-grid { columns: 3; column-gap: 4px; }
  .apple-dev-name { font-size: 10px; }
}


.default-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.default-group-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 22px;
  padding: 16px;
  box-shadow: 0 10px 28px rgba(15,23,42,.06);
}
.default-dev-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.default-dev-card {
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  background: #f8fafc;
  padding: 12px;
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.default-dev-card:hover {
  box-shadow: 0 8px 18px rgba(15,23,42,.08);
  transform: translateY(-1px);
}
.default-dev-head {
  display:flex;
  align-items:center;
  gap:10px;
}
.default-dev-name { font-weight: 700; color: #0f172a; }
.default-dev-sub { font-size: 12px; color: #64748b; margin-top: 6px; }
@media (max-width: 900px) {
  .default-dev-grid { grid-template-columns: 1fr; }
}


.default-table-group {
  margin-top: 14px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 22px;
  box-shadow: 0 10px 28px rgba(15,23,42,.06);
  overflow: hidden;
}
.default-table-group-head {
  padding: 16px 18px 10px;
  border-bottom: 1px solid #eef2f7;
}
.default-table-group-title {
  font-size: 18px;
  font-weight: 800;
}
.default-table-group-meta {
  font-size: 12px;
  color: #64748b;
  margin-top: 4px;
}
.grouped-device-table {
  min-width: 1100px;
}
body.dark .default-table-group {
  background:#0f172a;
  border-color:#223041;
  box-shadow:none;
}
body.dark .default-table-group-head {
  border-bottom-color:#223041;
}
body.dark .default-table-group-meta {
  color:#8ea0b8;
}


.screen-toggle-list {
  display:flex;
  flex-wrap:wrap;
  gap:10px 16px;
}
.screen-toggle-list .toggle-inline {
  padding: 4px 0;
}


.settings-grid {
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap:14px;
}
.settings-card, .export-group-card {
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:20px;
  padding:16px;
  box-shadow:0 10px 28px rgba(15,23,42,.06);
}
.settings-card textarea {
  width:100%;
  min-height:220px;
  border:1px solid #dbe3ef;
  border-radius:12px;
  padding:12px;
  font:inherit;
  background:#fff;
  color:#0f172a;
}
.export-toolbar {
  display:flex;
  flex-wrap:wrap;
  gap:12px;
  align-items:center;
  margin-bottom:14px;
}
.export-groups {
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap:14px;
}
/* 无 view_note 权限：隐藏导出工具栏的「导出用户」选项（与页面其他用户展示位一致） */
body.no-view-note .export-note-opt { display:none; }
.export-group-head {
  padding-bottom:10px;
  border-bottom:1px solid #eef2f7;
  margin-bottom:10px;
}
.export-device-list {
  display:flex;
  flex-direction:column;
  gap:8px;
}
.export-device-row {
  display:flex;
  flex-wrap:wrap;
  gap:4px 12px;
  align-items:center;
  border-top:1px solid #f1f5f9;
  padding-top:8px;
}
.export-device-row:first-child { border-top:0; padding-top:0; }
.export-device-main { font-weight:600; white-space:nowrap; }
.export-device-hw {
  width:100%;
  font-size:11px;
  line-height:1.4;
  word-break:break-all;
}
body.dark .settings-card,
body.dark .export-group-card {
  background:#0f172a;
  border-color:#223041;
  box-shadow:none;
}
body.dark .settings-card textarea {
  background:#111827;
  color:#e5eefb;
  border-color:#223041;
}
body.dark .export-group-head,
body.dark .export-device-row { border-color:#223041; }

/* Sortable group list */
.sortable-list { display:flex; flex-direction:column; gap:6px; min-height:120px; }
.sortable-item {
  display:flex; align-items:center; gap:10px;
  padding:10px 12px; background:#f8fafc; border:1px solid #e2e8f0;
  border-radius:10px; cursor:move; user-select:none;
  transition:transform .15s, box-shadow .15s;
}
.sortable-item:hover { background:#f1f5f9; }
.sortable-item.dragging {
  opacity:.6; transform:scale(1.02);
  box-shadow:0 8px 24px rgba(15,23,42,.12);
}
.sortable-handle {
  color:#94a3b8; font-size:14px; line-height:1;
  cursor:grab;
}
.sortable-label { font-size:14px; color:#0f172a; flex:1; }
body.dark .sortable-item { background:#111827; border-color:#223041; }
body.dark .sortable-item:hover { background:#1a2535; }
body.dark .sortable-label { color:#e5eefb; }


.copy-mac-btn {
  margin-left: 8px;
  border: 1px solid #dbe3ef;
  background: #fff;
  color: #2563eb;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  line-height: 1.5;
  cursor: pointer;
}
.copy-mac-btn:hover { background:#eff6ff; }
.copy-mac-btn.copied { color:#16a34a; border-color:#bbf7d0; background:#f0fdf4; }
.copy-mac-btn.disabled { color:#94a3b8; cursor:default; }
.mac-copy-row, .mac-copy-cell {
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.mac-copy-inline {
  display:inline-flex;
  align-items:center;
}
body.dark .copy-mac-btn {
  background:#0f172a;
  border-color:#223041;
  color:#93c5fd;
}
body.dark .copy-mac-btn:hover { background:#132038; }
body.dark .copy-mac-btn.copied { background:#052e16; border-color:#166534; color:#86efac; }


.settings-form-grid {
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap:12px;
}
.settings-form-grid label {
  display:flex;
  flex-direction:column;
  gap:6px;
  font-size:13px;
  color:#475569;
}
.settings-form-grid input[type="number"],
.settings-form-grid input[type="color"] {
  width:100%;
  min-height:38px;
  border:1px solid #dbe3ef;
  border-radius:10px;
  background:#fff;
}
.disk-usage-inline {
  width:128px;
  margin:0 auto;
  text-align:center;
}
.disk-usage-top {
  font-size:11px;
  font-weight:600;
  margin-bottom:3px;
  white-space:nowrap;
}
.disk-usage-bar {
  width:100%;
  height:6px;
  background:#e5e7eb;
  border-radius:999px;
  overflow:hidden;
}
.disk-usage-bar-fill {
  height:100%;
  border-radius:999px;
}
.hw-gauges {
  display:flex;
  gap:22px;
  justify-content:flex-start;
  margin-bottom:10px;
}
.hw-gauge {
  position:relative;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:5px;
}
.hw-gauge-circle {
  width:54px;
  height:54px;
  border-radius:50%;
  background:conic-gradient(var(--c) calc(var(--p) * 1%), #e5e7eb 0);
  display:flex;
  align-items:center;
  justify-content:center;
  position:relative;
}
.hw-gauge-circle::before {
  content:'';
  position:absolute;
  inset:6px;
  border-radius:50%;
  background:#fff;
}
.hw-gauge-num {
  position:relative;
  font-size:12px;
  font-weight:700;
  font-variant-numeric:tabular-nums;
}
.hw-gauge-lbl {
  font-size:11px;
  color:#64748b;
}
.hw-gauge-tip {
  position:absolute;
  bottom:calc(100% + 8px);
  left:50%;
  transform:translateX(-50%);
  background:#0f172a;
  color:#e2e8f0;
  border:1px solid #1e293b;
  padding:7px 10px;
  border-radius:8px;
  font-size:11px;
  line-height:1.55;
  white-space:nowrap;
  text-align:left;
  opacity:0;
  pointer-events:none;
  transition:opacity .12s ease;
  z-index:30;
  box-shadow:0 6px 18px rgba(0,0,0,.25);
}
.hw-gauge:hover .hw-gauge-tip { opacity:1; }
.hw-gauge-tip .gt-title {
  font-weight:700;
  margin-bottom:3px;
  color:#fff;
}
.hw-gauge-tip b { color:#fff; }
body.dark .hw-gauge-circle { background:conic-gradient(var(--c) calc(var(--p) * 1%), #334155 0); }
body.dark .hw-gauge-circle::before { background:#0f172a; }
body.dark .hw-gauge-num { color:#cbd5e1; }
body.dark .hw-gauge-lbl { color:#94a3b8; }

/* 首页表格「硬件」列：圆形 CPU/内存 仪表（紧凑） */
.td-hardware .hw-gauges { gap:12px; margin-bottom:0; }
.td-hardware .hw-gauge-circle { width:32px; height:32px; }
.td-hardware .hw-gauge-circle::before { inset:4px; }
.td-hardware .hw-gauge-num { font-size:10px; }
.td-hardware .hw-gauge-lbl { font-size:9px; }
.td-hardware .hw-gauge-tip { z-index:40; }
body.dark .td-hardware .hw-gauge-lbl { color:#94a3b8; }
@media (max-width: 640px) {
  .grouped-device-table td.td-hardware { display:none; }
}

body.dark .settings-form-grid label { color:#cbd5e1; }
body.dark .settings-form-grid input[type="number"],
body.dark .settings-form-grid input[type="color"] {
  border-color:#223041;
  background:#111827;
}
body.dark .disk-usage-bar { background:#223041; }

.grouped-device-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.grouped-device-table th,
.grouped-device-table td {
  text-align: center;
  vertical-align: middle;
}
.grouped-device-table td {
  padding: 10px 8px;
}
.grouped-device-table th {
  font-size: 11px;
}
/* Hide mobile-only columns on desktop */
.grouped-device-table td.td-group,
.grouped-device-table td.td-cpu-mem,
.grouped-device-table td.td-uptime-rate,
.grouped-device-table td.td-note,
.grouped-device-table th.th-mob {
  display: none;
}
.td-center {
  text-align: center;
}
/* 电脑端默认首页：设备名称靠左（带后缀时各行列对齐更整齐），仅作用于名称链接，不影响「详情」按钮 */
@media (min-width: 701px) {
  td.td-name { text-align: left; }
  td.td-name .row-device-name { justify-content: flex-start; text-align: left; }
  th.th-name { text-align: left; }
}
.row-note-edit {
  cursor: pointer;
  color: #2563eb;
  transition: color .15s;
}
.row-note-edit:hover {
  color: #1d4ed8;
  text-decoration: underline;
}
body.dark .row-note-edit {
  color: #60a5fa;
}
body.dark .row-note-edit:hover {
  color: #93c5fd;
}
.net-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  line-height: 1.25;
}
.net-line {
  display:flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  white-space:nowrap;
}
.net-label {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:16px;
  height:16px;
  border-radius:999px;
  background:#eff6ff;
  color:#2563eb;
  font-size:10px;
  font-weight:700;
}
.mac-copy-cell {
  justify-content: center;
  border-bottom: none !important;
}
.mac-copy-inline {
  white-space: nowrap;
}
.copy-mac-btn {
  margin-left: 0;
  padding: 1px 6px;
  font-size: 10px;
}
body.dark .net-label {
  background:#132038;
  color:#93c5fd;
}


.mac-copy-box {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  flex-wrap:wrap;
  width:100%;
}
.grouped-device-table td.mac-copy-cell,
.grouped-device-table td .mac-copy-box {
  text-align:center;
}
.status-stack {
  display:inline-flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:4px;
  line-height:1.2;
}
.status-main {
  font-size:12px;
  font-weight:700;
}
.status-main.online { color:#16a34a; }
.status-main.offline { color:#dc2626; }
.status-sub {
  font-size:11px;
  color:#94a3b8;
  text-align:center;
  word-break:break-word;
}
.net-label {
  min-width:36px;
  padding:0 6px;
}
body.dark .status-sub { color:#8ea0b8; }



/* 设备详情弹窗「总览」面板：2 列网格卡片布局
   修复前 .device-overview-grid/.overview-card/.overview-pair/.overview-list 全部缺失基础样式，
   导致 8 个 overview-card 纵向堆叠，状态等所有信息排成一列，要拖动很久 */
.device-overview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.overview-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  min-width: 0;
}
.overview-card.overview-card-full { grid-column: 1 / -1; }  /* 「用户」卡占满整行 */
.overview-card h4 {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  margin: 0 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid #eef2f7;
}
.overview-pair {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; padding: 3px 0; min-width: 0;
}
.overview-pair > span { color: #94a3b8; font-size: 11px; flex-shrink: 0; }
.overview-pair > strong {
  color: #0f172a; font-weight: 600; font-size: 12px;
  text-align: right; word-break: break-all; min-width: 0;
}
.overview-muted { color: #94a3b8; }
.overview-alert-line { margin: 4px 0; font-size: 11px; }
.overview-list {
  margin-top: 6px; display: flex; flex-direction: column; gap: 3px;
  max-height: 160px; overflow-y: auto;
}
.overview-list-item {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  background: #fff; border: 1px solid #eef2f7; border-radius: 6px;
  padding: 4px 7px; font-size: 11px; min-width: 0;
}
.overview-list-item > strong { color: #475569; font-weight: 600; }
.overview-list-item > span { color: #0f172a; word-break: break-all; min-width: 0; }
/* Live 时间段单行显示（2026/08/29 20:04:03 ~ 次日 05:18:47） */
.overview-list-item.live-span-item { justify-content: flex-start; }
.overview-list-item.live-span-item > span { word-break: normal; font-variant-numeric: tabular-nums; }
.overview-note { font-size: 12px; color: #0f172a; font-weight: 500; }
.overview-other { margin-top: 6px; font-size: 12px; color: #0f172a; font-weight: 500; }
.ov-label { color: #94a3b8; font-weight: 600; }
.homepage-link { color: #2563eb; text-decoration: none; word-break: break-all; display: inline-flex; align-items: center; gap: 4px; }
.homepage-link:hover { color: #1d4ed8; opacity: 0.85; }
body.dark .homepage-link { color: #60a5fa; }
body.dark .homepage-link:hover { color: #93c5fd; }
.hp-logo { width: 22px; height: 22px; display: block; flex-shrink: 0; }
.hp-handle { font-size: 12px; font-weight: 600; color: #0f172a; line-height: 1; white-space: nowrap; }
.hp-tiktok:hover .hp-handle { color: #1d4ed8; }
body.dark .hp-handle { color: #e2e8f0; }
body.dark .hp-tiktok:hover .hp-handle { color: #93c5fd; }
/* 直播卡片里主页跳转的 @id 小字体 */
.hp-handle-sm { font-size: 10px; font-weight: 500; color: #64748b; }
.hp-live-jump { margin-left: 2px; }
/* 直播卡片：个人主页跳转换行显示（名称下一行），logo 缩小，左对齐与下方时间对齐；无主页时留空行保持时间位置一致 */
/* min-height 需 >= 暱称+@handle 两行的高度，没有主页的卡片才会留一样高的空行、时间行不错位 */
.live-room-homepage { display: flex; align-items: center; gap: 4px; min-height: 28px; }
.live-room-homepage .hp-logo { width: 13px; height: 13px; }
body.dark .hp-handle-sm { color: #94a3b8; }
/* 直播卡专用：暱称一行、@handle 下一行。
   align-items:center → logo 在左侧跨两行垂直居中，与右侧「暱称+id」整块齐平（不是只贴第一行顶部） */
.homepage-link.hp-stack { align-items: center; }
.hp-stack-txt { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.hp-stack-txt .hp-nick { font-size: 10px; font-weight: 600; color: #0f172a; }
.hp-stack-txt .hp-at { font-size: 9px; font-weight: 500; color: #64748b; }
body.dark .hp-stack-txt .hp-nick { color: #e2e8f0; }
body.dark .hp-stack-txt .hp-at { color: #94a3b8; }
body.dark .overview-other { color: #e2e8f0; }
body.dark .overview-card { background: #131c31; border-color: #1e293b; }
body.dark .overview-card h4 { color: #94a3b8; border-color: #1e293b; }
body.dark .overview-pair > strong { color: #e2e8f0; }
body.dark .overview-list-item { background: #0f172a; border-color: #1e293b; }
body.dark .overview-list-item > strong { color: #94a3b8; }
body.dark .overview-list-item > span { color: #e2e8f0; }
body.dark .overview-note { color: #e2e8f0; }
body.dark .overview-alert-line { color: #cbd5e1; }


.device-overview-header .device-overview-sub {
  font-size: 10px !important;
  line-height: 1.3 !important;
  color: #64748b;
}
.device-overview-grid .power-card .overview-list-item strong {
  font-size: 10px !important;
  line-height: 1.25 !important;
}
.device-overview-grid .power-card .overview-list-item span {
  font-size: 10px !important;
  line-height: 1.25 !important;
}
body.dark .device-overview-header .device-overview-sub {
  color: #8ea0b8;
}

.modal-sub span { font-size: 11px; line-height: 1.25; }


.traffic-hours-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 10px;
  margin: 12px 0 18px;
}
.traffic-hour-card {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 9px;
  background: #f8fafc;
}
.traffic-hour-time { font-size: 10px; color: #64748b; margin-bottom: 4px; }
.traffic-hour-total { font-size: 13px; font-weight: 800; color: #0f172a; }
.traffic-hour-split { font-size: 10px; color: #64748b; margin-top: 3px; line-height:1.25; }
.heatmap-toolbar {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
  flex-wrap:wrap;
  margin-bottom:14px;
}
.traffic-ranking-panel, .traffic-heatmap-panel {
  margin-top: 16px;
}
.traffic-ranking-list {
  display:grid;
  gap:10px;
}
.traffic-rank-item {
  display:grid;
  grid-template-columns: 34px 1fr auto;
  gap: 12px;
  align-items:center;
  padding: 10px 12px;
  border:1px solid #e2e8f0;
  border-radius: 12px;
  background:#f8fafc;
}
.traffic-rank-no {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background:#dbeafe;
  color:#1d4ed8;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:800;
}
.traffic-rank-main { display:flex; flex-direction:column; min-width:0; }
.traffic-rank-main strong { font-size: 14px; color:#0f172a; }
.traffic-rank-main span { font-size: 11px; color:#64748b; }
.traffic-rank-total { font-size: 14px; font-weight: 800; color:#0f172a; }
.traffic-heatmap-scroll { overflow-x:auto; padding-bottom: 8px; }
.traffic-heatmap-cols {
  display:flex;
  align-items:flex-start;
  gap:6px;
  min-width:max-content;
}
.traffic-day-col { display:flex; flex-direction:column; gap:4px; align-items:center; }
.traffic-day-label { font-size:10px; color:#64748b; margin-bottom:2px; }
.traffic-heat-cell {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background:#ebedf0;
}
.traffic-heat-cell.lv1 { background:#9be9a8; }
.traffic-heat-cell.lv2 { background:#40c463; }
.traffic-heat-cell.lv3 { background:#30a14e; }
.traffic-heat-cell.lv4 { background:#216e39; }
.traffic-heatmap-legend {
  display:flex;
  align-items:center;
  gap:6px;
  justify-content:flex-end;
  font-size:11px;
  color:#64748b;
  margin-top:10px;
}
.traffic-heatmap-legend i {
  width:12px;
  height:12px;
  border-radius:3px;
  display:inline-block;
  background:#ebedf0;
}
.traffic-heatmap-legend .lv1 { background:#9be9a8; }
.traffic-heatmap-legend .lv2 { background:#40c463; }
.traffic-heatmap-legend .lv3 { background:#30a14e; }
.traffic-heatmap-legend .lv4 { background:#216e39; }
body.dark .traffic-hour-card,
body.dark .traffic-rank-item {
  background:#0f172a;
  border-color:#223041;
}
body.dark .traffic-hour-total,
body.dark .traffic-rank-main strong,
body.dark .traffic-rank-total {
  color:#e5eefb;
}
body.dark .traffic-hour-time,
body.dark .traffic-hour-split,
body.dark .traffic-rank-main span,
body.dark .traffic-day-label,
body.dark .traffic-heatmap-legend {
  color:#8ea0b8;
}
body.dark .traffic-rank-no {
  background:#132038;
  color:#93c5fd;
}
body.dark .traffic-heat-cell.lv0,
body.dark .traffic-heatmap-legend .lv0 { background:#1f2937; }

.traffic-day-cards {
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:8px;
  margin:10px 0 12px;
}
.traffic-day-card {
  border:1px solid #e2e8f0;
  border-radius:12px;
  padding:10px;
  background:#f8fafc;
  text-align:left;
  cursor:pointer;
  color:inherit;
  font:inherit;
}
.traffic-day-card.active {
  border-color:#2563eb;
  box-shadow:0 0 0 2px rgba(37,99,235,.12);
}
.traffic-day-card:hover {
  border-color:#93c5fd;
  box-shadow:0 8px 24px rgba(37,99,235,.10);
}
.traffic-day-head {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  margin-bottom:8px;
}
.traffic-day-date { font-size:12px; color:#64748b; }
.traffic-day-tag {
  font-size:10px;
  color:#1d4ed8;
  background:#dbeafe;
  border-radius:999px;
  padding:2px 6px;
  font-weight:700;
}
.traffic-day-total { font-size:14px; font-weight:800; color:#0f172a; }
.traffic-day-split { font-size:10px; color:#64748b; margin-top:3px; }
.traffic-hours-title { font-size:12px; font-weight:700; margin:2px 0 8px; color:#0f172a; }
.traffic-hours-grid-inner {
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap:8px;
}
@media (max-width: 900px) {
  .traffic-hours-grid-inner { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .traffic-day-cards, .traffic-hours-grid-inner { grid-template-columns: 1fr; }
}
body.dark .traffic-day-card {
  background:#0f172a;
  border-color:#223041;
}
body.dark .traffic-day-total,
body.dark .traffic-hours-title {
  color:#e5eefb;
}
body.dark .traffic-day-date,
body.dark .traffic-day-split {
  color:#8ea0b8;
}
body.dark .traffic-day-tag {
  background:#132038;
  color:#93c5fd;
}

.traffic-stats-cards {
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap:16px;
  margin-top: 16px;
}
.traffic-stat-card {
  position:relative;
  overflow:hidden;
  border-radius:24px;
  padding:18px;
  background:linear-gradient(180deg, rgba(255,255,255,.96), rgba(241,245,249,.96));
  border:1px solid rgba(226,232,240,.95);
  box-shadow:0 18px 44px rgba(15,23,42,.08);
}
.traffic-stat-top {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}
.traffic-stat-name { font-size:18px; font-weight:800; color:#0f172a; }
.traffic-stat-meta { font-size:12px; color:#64748b; margin-top:4px; }
.traffic-stat-pill {
  padding:6px 10px;
  border-radius:999px;
  background:#eef2ff;
  color:#4338ca;
  font-size:11px;
  font-weight:700;
  white-space:nowrap;
}
.traffic-stat-big {
  font-size:30px;
  font-weight:900;
  letter-spacing:-0.02em;
  color:#0f172a;
  margin-top:16px;
}
.traffic-stat-sub { font-size:12px; color:#64748b; margin-top:6px; }
.traffic-stat-grid {
  margin-top:16px;
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:10px;
}
.traffic-stat-grid div {
  border-radius:16px;
  background:rgba(255,255,255,.75);
  border:1px solid #e2e8f0;
  padding:12px;
}
.traffic-stat-grid span { display:block; font-size:11px; color:#64748b; margin-bottom:5px; }
.traffic-stat-grid strong { font-size:15px; color:#0f172a; }
body.dark .traffic-stat-card {
  background:linear-gradient(180deg, rgba(15,23,42,.98), rgba(17,24,39,.98));
  border-color:#243244;
  box-shadow:none;
}
body.dark .traffic-stat-name,
body.dark .traffic-stat-big,
body.dark .traffic-stat-grid strong { color:#e5eefb; }
body.dark .traffic-stat-meta,
body.dark .traffic-stat-sub,
body.dark .traffic-stat-grid span { color:#8ea0b8; }
body.dark .traffic-stat-grid div { background:rgba(30,41,59,.55); border-color:#223041; }
body.dark .traffic-stat-pill { background:#1e293b; color:#c7d2fe; }
@media (max-width: 640px) {
  .traffic-stats-cards { grid-template-columns: 1fr; }
  .traffic-stat-big { font-size:26px; }
}

/* 实时网速：按出口 IP 聚合 */
.net-speed-summary {
  display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px;
}
.ns-sum-item {
  background: rgba(255,255,255,.85);
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 10px 14px;
  min-width: 120px;
}
.ns-sum-item span { display: block; font-size: 11px; color: #64748b; margin-bottom: 4px; }
.ns-sum-item strong { font-size: 17px; color: #0f172a; font-variant-numeric: tabular-nums; }

/* 主站记事本 */
/* 主站记事本：列表 + 进入式编辑 */
.np-list { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.np-row {
  display: flex; align-items: center; gap: 14px;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 14px;
  padding: 12px 16px; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .05s;
}
.np-row:hover { border-color: #38bdf8; box-shadow: 0 6px 18px rgba(15,23,42,.07); }
.np-row:active { transform: scale(.995); }
.np-row-main { flex: 1; min-width: 0; }
.np-row-title { font-size: 15px; font-weight: 700; color: #0f172a; }
.np-row-preview { font-size: 12.5px; color: #64748b; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-row-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 11px; color: #2563eb; white-space: nowrap; }
.np-editor { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
/* ---- 记事本待办能力 ---- */
.np-check { display: flex; align-items: center; flex: none; cursor: pointer; padding: 4px; }
.np-check input { width: 18px; height: 18px; cursor: pointer; accent-color: #16a34a; }
.np-row.np-done { opacity: .62; background: #f8fafc; }
.np-row.np-done .np-row-title { text-decoration: line-through; color: #94a3b8; }
/* 置顶且已完成：保持正常颜色、不划线（指定的置顶项不被弱化） */
.np-row.np-done.np-pinned { opacity: 1; background: #fffdf5; }
.np-row.np-done.np-pinned .np-row-title { text-decoration: none; color: #0f172a; }
.np-dev-tag {
  display: inline-block; font-size: 11px; font-weight: 600; color: #4338ca;
  background: #eef2ff; border: 1px solid #c7d2fe; border-radius: 999px; padding: 1px 8px; margin-left: 6px;
}
.np-done-tag {
  display: inline-block; font-size: 11px; font-weight: 600; color: #15803d;
  background: #dcfce7; border: 1px solid #86efac; border-radius: 999px; padding: 1px 8px; margin-left: 6px;
}
/* ---- 记事本置顶能力 ---- */
.np-row-actions { display: flex; flex: none; align-items: center; }
.np-pin-btn {
  font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap;
  color: #64748b; background: #f1f5f9; border: 1px solid #e2e8f0;
  border-radius: 999px; padding: 4px 12px; transition: color .15s, background .15s, border-color .15s;
}
.np-pin-btn:hover { color: #0f172a; border-color: #cbd5e1; }
.np-pin-btn.active { color: #b45309; background: #fef3c7; border-color: #fcd34d; }
.np-pin-tag {
  display: inline-block; font-size: 11px; font-weight: 700; color: #b45309;
  background: #fef3c7; border: 1px solid #fcd34d; border-radius: 999px; padding: 1px 8px; margin-left: 6px;
}
.np-row.np-pinned { border-color: #fcd34d; }
.np-pin-wrap { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; cursor: pointer; }
.np-pin-wrap input { width: 17px; height: 17px; cursor: pointer; accent-color: #d97706; }
.np-done-wrap { display: flex; align-items: center; gap: 6px; margin-left: auto; margin-right: auto; font-size: 13px; font-weight: 600; cursor: pointer; }
.np-done-wrap input { width: 17px; height: 17px; cursor: pointer; accent-color: #16a34a; }
.np-extra { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.np-field { display: flex; flex-direction: column; gap: 6px; }
.np-field > label { font-size: 12px; font-weight: 600; color: #475569; }
.np-dev-pick { position: relative; }
.np-push-list { display: flex; flex-direction: column; gap: 4px; max-height: 132px; overflow-y: auto; }
.np-push-item { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: #334155; cursor: pointer; }
.np-push-item input { cursor: pointer; accent-color: #2563eb; }
body.dark .np-dev-tag { color: #a5b4fc; background: #1e293b; border-color: #334155; }
body.dark .np-done-tag { color: #86efac; background: #14361f; border-color: #166534; }
body.dark .np-row.np-done { background: #0f172a; }
body.dark .np-row.np-done.np-pinned { opacity: 1; background: #1a1407; }
body.dark .np-row.np-done.np-pinned .np-row-title { text-decoration: none; color: #e5eefb; }
body.dark .np-pin-btn { color: #94a3b8; background: #1e293b; border-color: #334155; }
body.dark .np-pin-btn:hover { color: #e5eefb; border-color: #475569; }
body.dark .np-pin-btn.active { color: #fcd34d; background: #3a2c0a; border-color: #78551a; }
body.dark .np-pin-tag { color: #fcd34d; background: #3a2c0a; border-color: #78551a; }
body.dark .np-row.np-pinned { border-color: #78551a; }
body.dark .np-push-item { color: #cbd5e1; }
body.dark .np-field > label { color: #94a3b8; }
/* ---- 手机端记事本行：标题独占首行，时间+置顶按钮换到第二行，避免标题被挤压换行 ---- */
@media (max-width: 640px) {
  .np-row { flex-wrap: wrap; align-items: flex-start; gap: 6px 10px; padding: 10px 12px; }
  .np-row-main { flex: 1 1 calc(100% - 44px); min-width: 0; }
  .np-row-title { font-size: 14px; line-height: 1.35; }
  .np-row-preview { font-size: 12px; }
  /* 时间移到第二行左侧，横向排列更紧凑 */
  .np-row-meta {
    order: 3; flex: 1 1 auto; flex-direction: row; align-items: center;
    justify-content: flex-start; gap: 10px; font-size: 10.5px; color: #94a3b8; margin-top: 2px;
  }
  body.dark .np-row-meta { color: #64748b; }
  /* 置顶按钮移到第二行右侧 */
  .np-row-actions { order: 4; flex: 0 0 auto; justify-content: flex-end; margin-top: 2px; }
}
/* ---- 首页待办事项提示条 / 弹窗 ---- */
.todo-banner {
  display: flex; align-items: center; gap: 8px; margin-top: 12px;
  background: #fffbeb; border: 1px solid #fcd34d; color: #92400e;
  border-radius: 12px; padding: 10px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.todo-banner:hover { background: #fef3c7; }
.todo-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #f59e0b; flex: none;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, .18);
}
.todo-mask {
  position: fixed; inset: 0; z-index: 3000; background: rgba(15, 23, 42, .45);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.todo-panel {
  background: #fff; border-radius: 16px; width: 100%; max-width: 520px;
  max-height: 80vh; display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .25);
}
.todo-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid #e2e8f0; }
.todo-head-title { font-size: 15px; font-weight: 700; color: #0f172a; }
.todo-list { overflow-y: auto; padding: 8px 12px; }
.todo-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 6px; border-bottom: 1px solid #f1f5f9; }
.todo-item:last-child { border-bottom: none; }
.todo-check { flex: none; padding-top: 2px; }
.todo-check input { width: 17px; height: 17px; cursor: pointer; accent-color: #16a34a; }
.todo-main { min-width: 0; flex: 1; }
.todo-title { font-size: 13.5px; font-weight: 700; color: #0f172a; }
.todo-content { font-size: 12.5px; color: #64748b; margin-top: 3px; word-break: break-word; }
.todo-foot { padding: 12px 16px; border-top: 1px solid #e2e8f0; display: flex; justify-content: flex-end; }
body.dark .todo-banner { background: #3b2f10; border-color: #b45309; color: #fcd34d; }
body.dark .todo-panel { background: #0f172a; border: 1px solid #223041; }
body.dark .todo-head, body.dark .todo-foot { border-color: #223041; }
body.dark .todo-head-title, body.dark .todo-title { color: #e5eefb; }
body.dark .todo-content { color: #94a3b8; }
body.dark .todo-item { border-color: #1a2436; }
.np-editor-bar { display: flex; align-items: center; gap: 10px; }
.np-edit-title { font-size: 16px; font-weight: 700; color: #0f172a; border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px 12px; background: #f8fafc; }
.np-edit-title:focus { outline: 2px solid #38bdf8; outline-offset: 0; border-color: #38bdf8; background: #fff; }
.np-edit-content { width: 100%; min-height: 320px; resize: vertical; font-size: 14px; line-height: 1.7; color: #1e293b; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px; background: #f8fafc; font-family: inherit; }
.np-edit-content:focus { outline: 2px solid #38bdf8; outline-offset: 0; border-color: #38bdf8; background: #fff; }
.np-editor-foot { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.np-editor-status { font-size: 12px; color: #16a34a; }
.np-editor-meta { font-size: 11.5px; color: #2563eb; }
body.dark .np-row { background: #0e1626; border-color: #223041; }
body.dark .np-row:hover { border-color: #38bdf8; box-shadow: 0 6px 18px rgba(0,0,0,.35); }
body.dark .np-row-title { color: #e5eefb; }
body.dark .np-row-preview { color: #8ea0b8; }
body.dark .np-row-meta { color: #60a5fa; }
body.dark .np-edit-title { color: #e5eefb; background: #0b1220; border-color: #2b3a4d; }
body.dark .np-edit-content { color: #cdd9e6; background: #0b1220; border-color: #2b3a4d; }
body.dark .np-editor-status { color: #4ade80; }
body.dark .np-editor-meta { color: #60a5fa; }
.btn.small { padding: 5px 12px; font-size: 12px; }
.btn.danger { background: #fee2e2; color: #dc2626; border-color: #fecaca; }
.btn.danger:hover { background: #fecaca; }
body.dark .btn.danger { background: #3b1d1d; color: #fca5a5; border-color: #5b2a2a; }
body.dark .btn.danger:hover { background: #5b2a2a; }
/* 记事本回收站 */
.np-trash-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.np-trash-row { cursor: default; }
.np-trash-row:hover { border-color: #e2e8f0; box-shadow: none; }
body.dark .np-trash-row:hover { border-color: #223041; box-shadow: none; }
.np-trash-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.np-trash-actions .btn { white-space: nowrap; }
/* 实时网速峰值条 */
.net-peak {
  margin-top: 12px; margin-bottom: 4px;
  background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
  border-radius: 14px; padding: 9px 14px; color: #fff;
}
.net-peak .np-grid {
  display: grid; grid-template-columns: auto 1fr 1fr;
  gap: 4px 16px; align-items: center;
}
.net-peak .np-row { display: contents; }
.net-peak .np-head { border-bottom: 1px solid rgba(255,255,255,.25); padding-bottom: 5px; margin-bottom: 1px; }
.net-peak .np-head .np-k,
.net-peak .np-head .np-v { font-size: 11px; opacity: .9; font-weight: 700; letter-spacing: .3px; }
.net-peak .np-head .np-v { text-align: center; }
.net-peak .np-k { font-size: 12.5px; opacity: .95; white-space: nowrap; padding-right: 6px; }
.net-peak .np-v { display: flex; flex-direction: row; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 2px 10px; }
.net-peak .np-period { font-size: 15px; font-weight: 800; letter-spacing: .3px; }
.net-peak .np-up { font-size: 12.5px; color: #5eead4; font-variant-numeric: tabular-nums; }
.net-peak .np-down { font-size: 12.5px; color: #93c5fd; font-variant-numeric: tabular-nums; }
.net-peak .np-muted { font-size: 13px; opacity: .8; }
.net-peak .np-peak-muted { font-size: 13px; opacity: .9; }
body.dark .net-peak { background: linear-gradient(135deg, #0c4a6e 0%, #312e81 100%); }
.ns-sum-item strong.up { color: #0d9488; }
.ns-sum-item strong.down { color: #2563eb; }
.ns-sum-time { margin-left: auto; }
.net-speed-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.ns-card {
  border-radius: 22px;
  padding: 13px 15px;
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(241,245,249,.96));
  border: 1px solid rgba(226,232,240,.95);
  box-shadow: 0 18px 44px rgba(15,23,42,.08);
  display: flex;
  flex-direction: column;
  height: 300px;
}
.ns-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.ns-ip-wrap { min-width: 0; }
.ns-ip { font-size: 14px; font-weight: 800; color: #0f172a; word-break: break-all; line-height: 1.3; }
.ns-ip-sub { font-size: 11px; color: #64748b; margin-top: 2px; word-break: break-all; line-height: 1.3; }
.ns-count { font-size: 11px; color: #4338ca; background: #eef2ff; padding: 3px 9px; border-radius: 999px; font-weight: 700; white-space: nowrap; flex-shrink: 0; }
.ns-total { display: flex; gap: 8px; margin-top: 10px; }
.ns-total-item {
  flex: 1; border-radius: 16px; background: rgba(255,255,255,.75);
  border: 1px solid #e2e8f0; padding: 10px;
}
.ns-total-item span { display: block; font-size: 10px; color: #64748b; margin-bottom: 4px; }
.ns-total-item strong { font-size: 15px; font-variant-numeric: tabular-nums; }
.ns-total-item strong.up { color: #0d9488; }
.ns-total-item strong.down { color: #2563eb; }
.ns-devs { margin-top: 10px; display: flex; flex-direction: column; gap: 5px; flex: 1 1 auto; overflow-y: auto; min-height: 0; padding-right: 4px; scrollbar-width: thin; scrollbar-color: rgba(100,116,139,.4) transparent; }
.ns-devs::-webkit-scrollbar { width: 6px; }
.ns-devs::-webkit-scrollbar-thumb { background: rgba(100,116,139,.4); border-radius: 3px; }
.select { min-height: 34px; padding: 6px 10px; border-radius: 10px; border: 1px solid #cbd5e1; background: #fff; color: #0f172a; font-size: 13px; cursor: pointer; }
body.dark .select { background: #0b1220; border-color: #2b3a4d; color: #e5eefb; }
.ns-dev {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 12px;
  background: rgba(248,250,252,.9);
  border: 1px solid #eef2f7;
  font-size: 12px;
}
.ns-dev.is-off { opacity: .5; }
.ns-dev-name { color: #334155; font-weight: 600; word-break: break-all; }
.ns-on { color: #16a34a; font-size: 10px; font-weight: 700; }
.ns-off { color: #94a3b8; font-size: 10px; font-weight: 700; }
.ns-dev-up { color: #0d9488; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ns-dev-down { color: #2563eb; font-variant-numeric: tabular-nums; white-space: nowrap; }
body.dark .net-speed-summary .ns-sum-item { background: rgba(30,41,59,.55); border-color: #223041; }
body.dark .net-speed-summary .ns-sum-item span { color: #8ea0b8; }
body.dark .net-speed-summary .ns-sum-item strong { color: #e5eefb; }
body.dark .ns-card {
  background: linear-gradient(180deg, rgba(15,23,42,.98), rgba(17,24,39,.98));
  border-color: #243244; box-shadow: none;
}
body.dark .ns-ip { color: #e5eefb; }
body.dark .ns-ip-sub { color: #8ea0b8; }
body.dark .ns-count { background: #1e293b; color: #c7d2fe; }
body.dark .ns-total-item { background: rgba(30,41,59,.55); border-color: #223041; }
body.dark .ns-total-item span { color: #8ea0b8; }
body.dark .ns-total-item strong { color: #e5eefb; }
body.dark .ns-dev { background: rgba(30,41,59,.4); border-color: #223041; }
body.dark .ns-dev-name { color: #cbd5e1; }
body.dark .ns-dev-up { color: #2dd4bf; }
body.dark .ns-dev-down { color: #93c5fd; }
@media (max-width: 640px) {
  .net-speed-cards { grid-template-columns: 1fr; }
  .ns-sum-time { margin-left: 0; }
}

/* 直播时间段：设备筛选面板（TX / VN 系列快捷 + 单设备勾选统计） */
.lt-device-filter {
  margin-top:14px;
  padding:10px 12px;
  border:1px solid #e2e8f0;
  border-radius:10px;
  background:#f8fafc;
}
.lt-filter-quick {
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.lt-filter-label { font-size:13px; font-weight:600; }
.lt-filter-search {
  flex:0 1 200px;
  min-width:140px;
  padding:5px 9px;
  font-size:13px;
  border:1px solid #cbd5e1;
  border-radius:6px;
  background:#fff;
  color:inherit;
}
.lt-filter-count { font-size:12px; color:#64748b; }
.lt-device-list {
  display:flex;
  flex-wrap:wrap;
  gap:6px 16px;
  margin-top:9px;
  max-height:168px;
  overflow-y:auto;
}
.lt-dev-item {
  display:inline-flex;
  align-items:center;
  gap:5px;
  font-size:13px;
  cursor:pointer;
  user-select:none;
}
.lt-dev-item input { margin:0; cursor:pointer; }
body.dark .lt-device-filter { background:#0f172a; border-color:#1e293b; }
body.dark .lt-filter-search { background:#0b1220; border-color:#334155; color:#e2e8f0; }
body.dark .lt-filter-count { color:#94a3b8; }

.live-timeline-grid {
  margin-top:16px;
  display:grid;
  gap:12px;
}
.live-timeline-stats {
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-bottom:2px;
}
.stat-pill {
  display:flex;
  flex-direction:column;
  gap:2px;
  padding:8px 14px;
  border-radius:10px;
  background:#f1f5f9;
  border:1px solid #e2e8f0;
  min-width:140px;
  flex:1 1 140px;
}
.stat-pill .stat-k {
  font-size:11px;
  color:#64748b;
  font-weight:600;
}
.stat-pill .stat-v {
  font-size:17px;
  font-weight:800;
  color:#0f172a;
  line-height:1.2;
}
.stat-pill .stat-sub {
  font-size:11px;
  color:#94a3b8;
}
.stat-peak { background:#ecfdf5; border-color:#a7f3d0; }
.stat-peak .stat-v { color:#047857; }
.stat-trough { background:#fff7ed; border-color:#fed7aa; }
.stat-trough .stat-v { color:#c2410c; }
.stat-total { background:#eff6ff; border-color:#bfdbfe; }
.stat-total .stat-v { color:#1d4ed8; }
.stat-empty { flex:1 1 100%; color:#64748b; font-size:13px; }
.timeline-group {
  display: grid;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid #e2e8f0;
}
.live-timeline-head,
.live-timeline-row {
  display:grid;
  grid-template-columns: 180px 1fr;
  gap:12px;
  align-items:end;
}
.live-timeline-head {
  font-size:12px;
  color:#64748b;
  font-weight:700;
}
.live-timeline-device {
  padding:0 0 2px 0;
  background:transparent;
  border:none;
  border-radius:0;
  display:flex;
  flex-direction:column;
  justify-content:flex-end;
}
.live-timeline-device strong {
  display:block;
  font-size:14px;
  color:#0f172a;
  line-height:1.3;
}
.live-timeline-device > span {
  display:block;
  margin-top:4px;
  font-size:11px;
  color:#64748b;
}
.live-timeline-track {
  min-width:0;
  position: relative;
}
/* 跨自然日虚竖线 */
.day-divider {
  position: absolute; top: 0; bottom: 0; width: 0;
  border-left: 1px dashed #94a3b8;
  z-index: 2; pointer-events: none;
}
body.dark .day-divider { border-left-color: #64748b; }

/* 直播时间段：鼠标悬停竖线 + 当前时间段直播设备数 */
.live-timeline-grid { position: relative; }
/* 直播时间段：鼠标悬停竖线（对齐参考，点击固定为橙色） */
.live-timeline-cursor {
  position: absolute; top: 0; width: 2px; background: #2563eb;
  pointer-events: none; z-index: 5; display: none;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, .25);
}
body.dark .live-timeline-cursor { background: #60a5fa; box-shadow: 0 0 0 1px rgba(96, 165, 250, .25); }
.live-timeline-cursor.ltPinned { background: #f59e0b; box-shadow: 0 0 0 1.5px rgba(245, 158, 11, .35); }
body.dark .live-timeline-cursor.ltPinned { background: #fbbf24; box-shadow: 0 0 0 1.5px rgba(251, 191, 36, .35); }
/* 白色可固定浮层：直播时间段 hover 显示「直播时间 几时几分 ~ 几时几分 · X台」（复制网速色块 speed-tip） */
.lt-tip {
  position: fixed; z-index: 9999; display: none;
  background: #ffffff; color: #0f172a; font-size: 12px; font-weight: 600;
  padding: 5px 10px; border-radius: 8px; border: 1px solid #e2e8f0;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .22); pointer-events: none;
  white-space: nowrap; max-width: 80vw;
}
.lt-tip.pinned { outline: 2px solid #3b82f6; outline-offset: 2px; }
body.dark .lt-tip { background: #1e293b; color: #e2e8f0; border-color: #334155; }
.live-timeline-hour-labels,
.live-timeline-bars {
  display:grid;
  grid-template-columns: repeat(var(--timeline-cols, 24), minmax(0, 1fr));
  gap: var(--slot-gap, 4px);
}
.live-timeline-hour-labels {
  min-height: 16px;
  margin-bottom: 4px;
}
.live-timeline-hour-labels span {
  font-size:10px;
  color:#94a3b8;
  text-align:center;
}
.live-slot {
  height:22px;
  border-radius:6px;
  background:#e5e7eb;
  border:1px solid #dbe3ee;
}
.live-slot.live {
  background:#ef4444;
  border-color:#dc2626;
}
.live-slot.idle {
  background:#e5e7eb;
}
.live-timeline-hour-labels.daily-labels span {
  font-size:11px;
  font-weight:600;
}
body.dark .live-timeline-device {
  background:transparent;
  border:none;
}
body.dark .live-timeline-device strong { color:#e5eefb; }
body.dark .live-timeline-device > span,
body.dark .live-timeline-head,
body.dark .live-timeline-hour-labels span { color:#8ea0b8; }
body.dark .live-slot.idle { background:#1f2937; border-color:#334155; }
body.dark .live-timeline-stats .stat-pill { background:#132038; border-color:#223041; }
body.dark .live-timeline-stats .stat-k { color:#8ea0b8; }
body.dark .live-timeline-stats .stat-v { color:#e5eefb; }
body.dark .live-timeline-stats .stat-sub { color:#6b7d96; }
body.dark .stat-peak { background:#0c2a22; border-color:#14532d; }
body.dark .stat-peak .stat-v { color:#34d399; }
body.dark .stat-trough { background:#2a1a0c; border-color:#7c2d12; }
body.dark .stat-trough .stat-v { color:#fb923c; }
body.dark .stat-total { background:#0c1a2e; border-color:#1e3a5f; }
body.dark .stat-total .stat-v { color:#60a5fa; }
body.dark .heatmap-group,
body.dark .timeline-group { border-top-color: #223041; }
@media (max-width: 900px) {
  .live-timeline-head,
  .live-timeline-row { grid-template-columns: 1fr; }
}

/* Push settings */
.push-keys-list { display:flex; flex-direction:column; gap:8px; margin-top:10px; }
.push-key-item {
  display:flex; align-items:center; justify-content:space-between;
  gap:10px; padding:10px 12px; border-radius:10px;
  border:1px solid #e2e8f0; background:#fff;
  flex-wrap:wrap;
}
.push-key-info { display:flex; flex-direction:column; gap:2px; min-width:140px; }
.push-key-info strong { font-size:14px; color:#0f172a; }
.push-key-actions { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.push-key-actions .toggle-inline { font-size:13px; }
.cpa-sel-wrap { margin-right:2px; display:flex; align-items:center; }
.push-key-item.disabled-item { opacity:0.6; }
.im-events { display:flex; flex-wrap:wrap; gap:4px 14px; margin-top:6px; max-width:680px; }
.im-events label { font-size:13px; color:#334155; cursor:pointer; }
body.dark .im-events label { color:#cbd5e1; }
.im-edit-box { padding:12px; background:#f8fafc; border:1px solid #e2e8f0; border-radius:8px; }
body.dark .im-edit-box { background:#0b1220; border-color:#1e293b; }
.im-edit-box input[type="number"] { width:54px; }
.im-edit-box input:not([type="number"]) { padding:4px 8px; border:1px solid #cbd5e1; border-radius:6px; }
body.dark .push-key-item { background:#0f172a; border-color:#1e293b; }
body.dark .push-key-info strong { color:#e5eefb; }
body.dark .push-key-info .muted { color:#8ea0b8; }

/* ===== Mobile comprehensive optimization ===== */
@media (max-width: 640px) {
  /* ---- General ---- */
  .wrap { padding: 0 12px; }
  .main { padding: 12px 12px 24px; }
  .btn { min-height: 40px; padding: 8px 12px; font-size: 13px; }
  input, select, textarea { min-height: 40px; padding: 8px 10px; font-size: 14px; }
  .grid.cards { grid-template-columns: 1fr; gap: 10px; }

  /* ---- Header / Toolbar（手机：两行紧凑） ---- */
  header { padding: 8px 12px 5px; position: relative; }
  .toolbar { flex-wrap: wrap; align-items: center; gap: 6px 10px; }
  .toolbar > div:first-child { flex: 1 1 auto; min-width: 0; }
  .toolbar .row { margin-left: 0; flex: 1 1 100%; order: 3; flex-wrap: wrap; justify-content: flex-start; gap: 6px; }
  #site-probe { flex: 0 1 auto; order: 2; height: 26px; gap: 9px; padding: 2px 8px; max-width: 62%; }
  .title { font-size: 16px; }
  .site-logo { width: 30px; height: 30px; }
  .tabs { flex-wrap: wrap; gap: 4px; }
  .tab { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
  .theme-select { font-size: 12px; padding: 4px 8px; min-height: 30px; }
  .theme-toggle { font-size: 14px; padding: 2px 7px; min-height: 30px; }
  .lang-select { font-size: 12px; padding: 4px 8px; min-height: 30px; }
  .btn-logout { font-size: 12px; padding: 5px 10px; min-height: 30px; }
  #user-name { display: none; }
  .lang-select { font-size: 12px; padding: 6px 8px; min-height: 34px; max-width: 156px; position: absolute; top: 10px; right: 12px; z-index: 5; }
  .theme-toggle { width: 34px; height: 34px; font-size: 14px; }
  .user-menu { font-size: 12px; gap: 6px; }
  .btn-logout { display: none; }

  /* ---- Login ---- */
  .login-page { padding: 12px; }
  .login-card { padding: 24px 18px 20px; max-width: 100%; border-radius: 16px; }
  .login-logo { width: 48px; height: 48px; border-radius: 14px; }
  .login-title { font-size: 18px; }
  .login-subtitle { font-size: 12px; }
  .login-form .form-group label { font-size: 12px; }
  .login-form input { min-height: 44px; }
  .login-btn { min-height: 44px; font-size: 14px; }
  .login-lang { margin-top: 14px; padding-top: 12px; }
  .login-lang-select { min-height: 44px; font-size: 14px; max-width: 100%; }

  /* ---- Dashboard (default) ---- */
  .ss-title { font-size: 20px; }
  .ss-overall { padding: 8px 12px; font-size: 12px; gap: 6px; }
  .ss-meta { flex-wrap: wrap; gap: 6px; }
  .ss-meta .pill { font-size: 10px; padding: 2px 6px; }
  .net-speed-value { font-size: 18px; }
  .section-title { font-size: 13px; margin: 14px 0 8px; }

  /* ---- Apple theme ----
     手机端为「1 分组 × 3 列设备」，每格约 110px，字号需比 2 列时更紧凑 */
  .apple-hero { padding: 12px; border-radius: 12px; }
  .apple-hero-title { font-size: 18px; }
  .apple-hero-sub { font-size: 11px; }
  .apple-overall { padding: 6px 10px; font-size: 11px; }
  .apple-group-card { padding: 10px; border-radius: 14px; }
  .apple-dev-item { padding: 2px 2px; gap: 3px; }
  .apple-dev-name { font-size: 11px; }
  .apple-dev-suffix { font-size: 10px; }
  .apple-dev-offline { font-size: 9px; margin-left: 1px; }
  .apple-icon-live, .apple-icon-screen-alert { width: 12px; height: 12px; }
  .apple-group-title { font-size: 12px; }
  .apple-group-meta { font-size: 10px; }

  /* ---- Tables -> Mobile Cards ---- */
  .grouped-device-table { font-size: 12px; display: block; }
  .grouped-device-table thead { display: none; }
  .grouped-device-table tbody { display: block; }
  .grouped-device-table tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 10px;
    padding: 12px;
    background: var(--card-bg, #fff);
    border-radius: 12px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid var(--border, #e2e8f0);
  }
  body.dark .grouped-device-table tr {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  }
  .grouped-device-table td {
    padding: 0;
    display: flex;
    align-items: center;
    gap: 4px;
  }
  .grouped-device-table td::before {
    content: attr(data-label);
    font-size: 10px;
    color: #94a3b8;
    flex-shrink: 0;
  }
  /* Desktop columns hidden on mobile */
  .grouped-device-table td.td-os,
  .grouped-device-table td.td-disk,
  .grouped-device-table td.td-action,
  .grouped-device-table th.th-mob { display: none; }
  /* Mobile-only columns shown */
  .grouped-device-table td.td-group,
  .grouped-device-table td.td-cpu-mem,
  .grouped-device-table td.td-uptime-rate,
  .grouped-device-table td.td-note { display: flex; }
  /* Grid placement for mobile card layout */
  .grouped-device-table td.td-status { grid-column: 1; grid-row: 1; }
  .grouped-device-table td.td-group { grid-column: 2; grid-row: 1; justify-content: flex-end; }
  .grouped-device-table td.td-group::before { display: none; }
  .grouped-device-table td.td-name { grid-column: 1 / -1; grid-row: 2; font-size: 14px; font-weight: 600; }
  .grouped-device-table td.td-name::before { display: none; }
  .grouped-device-table td.td-mac { grid-column: 1 / -1; grid-row: 3; font-size: 11px; }
  .grouped-device-table td.td-mac::before { display: none; }
  .grouped-device-table td.td-cpu-mem { grid-column: 1; grid-row: 4; }
  .grouped-device-table td.td-uptime-rate { grid-column: 2; grid-row: 4; justify-content: flex-end; }
  .grouped-device-table td.td-note { grid-column: 1 / -1; grid-row: 5; font-size: 11px; color: #64748b; }
  .grouped-device-table td.td-condition { grid-column: 1; grid-row: 6; }
  .grouped-device-table td.td-condition::before { display: none; }
  .grouped-device-table td.td-net { grid-column: 2; grid-row: 6; justify-content: flex-end; }
  .grouped-device-table td.td-net::before { display: none; }
  .table-wrap { margin: 0 -12px; padding: 0 12px; }

  /* ---- Modal ---- */
  .modal-card { max-width: 96%; border-radius: 14px; max-height: calc(100vh - 16px); }
  .modal-header { padding: 14px 16px 10px; }
  .modal-title { font-size: 16px; }
  .modal-sub { font-size: 10px; }
  .modal-body { padding: 12px 16px 16px; }
  .modal-tabs {
    /* 7 个 tab 在 350px 容器里用 flex:1 会被压成「一字一行」竖排。
       改为 4 列网格：2 行整齐排布，每 tab 等宽、文字完整 */
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 4px;
  }
  .modal-tab { padding: 6px 4px; font-size: 11px; }
  .modal-close { width: 32px; height: 32px; }

  /* ---- Modal info grid ---- */
  .detail-grid { gap: 10px 12px; }
  .ss-k { font-size: 11px; }
  .ss-v { font-size: 13px; }
  .screen-block { gap: 8px; }
  .screen-header { font-size: 13px; }
  .screen-toggles { padding: 8px 10px; gap: 8px 12px; }
  .screen-toggles .toggle-inline { font-size: 12px; }
  .mon-item { padding: 8px 10px; }
  .mon-badge { width: 18px; height: 18px; font-size: 10px; }

  /* ---- 设备详情「总览」面板：保留 2 列网格，缩小间距和字号，
         8 张卡片原本纵向堆叠（修基础样式后已 2 列 4 行），再紧凑化减少滚动 ---- */
  .device-overview-grid { gap: 8px; }
  .overview-card { padding: 8px 10px; font-size: 11px; }
  .overview-card h4 { font-size: 11px; margin-bottom: 4px; padding-bottom: 3px; }
  .overview-pair { padding: 2px 0; }
  .overview-pair > span,
  .overview-pair > strong { font-size: 11px; }
  .overview-list-item { font-size: 10px; padding: 3px 6px; }
  .overview-note { font-size: 11px; }
  .overview-list { max-height: 120px; }

  /* ---- Page settings ---- */
  .settings-card, .export-group-card { padding: 14px; border-radius: 12px; }
  .settings-card h3 { font-size: 14px; }
  .sortable-item { padding: 8px 10px; gap: 8px; }
  .sort-handle { width: 24px; height: 24px; }

  /* ---- Device export ---- */
  .export-group-card .row { flex-direction: column; align-items: stretch; gap: 8px; }

  /* ---- Traffic stats ---- */
  .traffic-stats-cards { grid-template-columns: 1fr; gap: 10px; }
  .traffic-stat-card { padding: 14px; }
  .traffic-stat-name { font-size: 15px; }
  .traffic-stat-big { font-size: 24px; }
  .traffic-day-cards { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .traffic-day-card { padding: 10px 12px; }
  .traffic-rank-item { padding: 8px 10px; }

  /* ---- Timeline (modal) ---- */
  .tl-day-row { grid-template-columns: 70px 1fr; gap: 6px; }
  .tl-day-label b { font-size: 10px; }
  .tl-day-label span { font-size: 9px; }
  .tl-cells { gap: 1px; }
  .tl-cell { height: 16px; border-radius: 2px; min-width: 4px; }
  .tl-hour-scale { margin-left: 76px; font-size: 9px; }

  /* ---- Live timeline ---- */
  .live-timeline-head { display: none; }
  .live-timeline-row { grid-template-columns: 1fr; gap: 6px; padding: 10px 0; border-bottom: 1px solid #e2e8f0; }
  .live-timeline-device { padding: 0; background: transparent; border: none; }
  .live-timeline-device strong { font-size: 13px; }
  .live-timeline-device span { font-size: 11px; }
  .live-timeline-bars { gap: 2px; }
  .live-slot { min-width: 6px; height: 18px; }
  .daily-labels span { font-size: 10px; }
  .daily-bars { gap: 3px; }

  /* ---- Push settings ---- */
  .push-key-item { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px; }
  .push-key-info { min-width: 0; }
  .push-key-actions { flex-wrap: wrap; gap: 8px; }
  .push-key-actions .toggle-inline { font-size: 12px; }

  /* ---- Sort bar / filters ---- */
  .sort-bar, .filter-bar { flex-direction: column; align-items: stretch; gap: 8px; }
  .sort-bar .row, .filter-bar .row { justify-content: space-between; }

  /* ---- Misc ---- */
  .refresh-fab { top: 6px; right: 6px; padding: 5px 8px; font-size: 11px; }
  .hardware-disks { gap: 8px; }
  .disk-item { padding: 10px 12px; gap: 6px; }
  .disk-header { font-size: 13px; }
  .ip-history-item { padding: 8px 4px; font-size: 12px; }
  .ip-toolbar { gap: 8px; }
}

/* ---- Speed heatmap (hourly traffic) ---- */
.speed-heatmap-grid {
  margin-top: 16px;
  display: grid;
  gap: 12px;
}
.heatmap-group {
  display: grid;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid #e2e8f0;
}
.speed-heatmap-head,
.speed-heatmap-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 12px;
  align-items: end;
}
.speed-heatmap-head {
  font-size: 12px;
  color: #64748b;
  font-weight: 700;
}
.speed-heatmap-device {
  padding: 0 0 2px 0;
  background: transparent;
  border: none;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.speed-heatmap-device strong {
  display: block;
  font-size: 14px;
  color: #0f172a;
  line-height: 1.3;
}
.speed-heatmap-device > span {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: #64748b;
}
.speed-heatmap-track {
  min-width: 0;
}
.speed-heatmap-labels,
.speed-heatmap-bars {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  gap: 4px;
}
.speed-heatmap-labels {
  min-height: 16px;
  margin-bottom: 4px;
}
.speed-heatmap-labels span {
  font-size: 10px;
  color: #94a3b8;
  text-align: center;
}
.speed-slot {
  height: 18px;
  border-radius: 5px;
  background: #e5e7eb;
  border: 1px solid #dbe3ee;
  cursor: pointer;
}
.speed-slot.lv0 { background: #e5e7eb; border-color: #dbe3ee; }
.speed-slot.lv1 { background: #bbf7d0; border-color: #86efac; }
.speed-slot.lv2 { background: #4ade80; border-color: #22c55e; }
.speed-slot.lv3 { background: #16a34a; border-color: #15803d; }
.speed-slot.lv4 { background: #dc2626; border-color: #b91c1c; }
.speed-slot.lv5 { background: #111111; border-color: #000000; }

/* 每小时网速色块：自定义可固定 tooltip */
.speed-tip {
  position: fixed; z-index: 9999; display: none;
  background: #0b1220; color: #e5eefb; font-size: 12px; font-weight: 500;
  padding: 6px 10px; border-radius: 8px; border: 1px solid #223041;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .3); pointer-events: none;
  white-space: nowrap; max-width: 80vw;
}
.speed-tip.pinned { outline: 2px solid #3b82f6; outline-offset: 2px; }
.speed-heatmap-legend {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-size: 12px;
  color: #64748b;
}
.speed-heatmap-legend i {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid;
}
.speed-heatmap-legend i.lv0 { background: #e5e7eb; border-color: #dbe3ee; }
.speed-heatmap-legend i.lv1 { background: #bbf7d0; border-color: #86efac; }
.speed-heatmap-legend i.lv2 { background: #4ade80; border-color: #22c55e; }
.speed-heatmap-legend i.lv3 { background: #16a34a; border-color: #15803d; }
.speed-heatmap-legend i.lv4 { background: #dc2626; border-color: #b91c1c; }
.speed-heatmap-legend i.lv5 { background: #111111; border-color: #000000; }
body.dark .speed-heatmap-device {
  background: transparent;
  border: none;
}
body.dark .speed-heatmap-device strong { color: #e5eefb; }
body.dark .speed-heatmap-device > span,
body.dark .speed-heatmap-head,
body.dark .speed-heatmap-labels span { color: #8ea0b8; }
body.dark .speed-slot.lv0 { background: #1f2937; border-color: #334155; }
body.dark .speed-slot.lv1 { background: #14532d; border-color: #166534; }
body.dark .speed-slot.lv2 { background: #15803d; border-color: #166534; }
body.dark .speed-slot.lv3 { background: #22c55e; border-color: #4ade80; }
body.dark .speed-slot.lv4 { background: #ef4444; border-color: #f87171; }
body.dark .speed-slot.lv5 { background: #000000; border-color: #333333; }
@media (max-width: 900px) {
  .speed-heatmap-head,
  .speed-heatmap-row { grid-template-columns: 1fr; }
}

/* ---- Account management ---- */
.settings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.settings-table th,
.settings-table td {
  border: 1px solid #e2e8f0;
  padding: 8px 10px;
  text-align: left;
}
.settings-table th {
  background: #f8fafc;
  font-weight: 600;
  color: #334155;
}
.settings-table tr:hover {
  background: #f8fafc;
}
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.badge-admin {
  background: #dbeafe;
  color: #1d4ed8;
}
.badge-user {
  background: #f3f4f6;
  color: #6b7280;
}
.nav-hidden {
  display: none !important;
}
.df-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.badge-super {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fcd34d;
}
body.dark .settings-table th {
  background: #1e293b;
  color: #e5eefb;
  border-color: #334155;
}
body.dark .settings-table td {
  border-color: #334155;
}
body.dark .settings-table tr:hover {
  background: #1e293b;
}
body.dark .badge-admin {
  background: #1e3a8a;
  color: #93c5fd;
}
body.dark .badge-user {
  background: #374151;
  color: #9ca3af;
}
body.dark .badge-super {
  background: #78350f;
  color: #fcd34d;
  border-color: #92400e;
}

/* Permission checkboxes */
.perm-checks {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 12px;
}
.perm-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 400;
  color: #334155;
  cursor: pointer;
  user-select: none;
}
.perm-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #2563eb;
  cursor: pointer;
}
body.dark .perm-check { color: #bfd3ef; }
@media (max-width: 640px) {
  .perm-checks { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .traffic-day-cards { grid-template-columns: 1fr; }
}

/* ============================================================
   Settings sub-tabs
   ============================================================ */
.settings-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 8px;
}
.settings-tab {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: #64748b;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.settings-tab:hover { background: #f1f5f9; color: #334155; }
.settings-tab.active { background: #eff6ff; color: #2563eb; border-color: #bfdbfe; }
body.dark .settings-tabs { border-color: #223041; }
body.dark .settings-tab { color: #8ea0b8; }
body.dark .settings-tab:hover { background: #1e293b; color: #e5eefb; }
body.dark .settings-tab.active { background: #1e3a5f; color: #93c5fd; border-color: #3b82f6; }

/* ============================================================
   Live Room
   ============================================================ */
.live-room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.live-room-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
/* --- 即将直播（预热中）：精简卡片，只保留 设备名 / 用户 / 网速 --- */
.upcoming-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; color: #d97706;
  font-size: 11px; font-weight: 800;
  padding: 3px 10px; border-radius: 999px;
  border: 1px solid #f59e0b;
  vertical-align: middle; margin-left: 4px;
  letter-spacing: 0.02em; white-space: nowrap;
}
.upcoming-live-card { padding: 8px 10px; gap: 4px; border-style: dashed; border-color: #fcd34d; position: relative; }
.upcoming-live-top { font-size: 13px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; padding-right: 70px; }
.upcoming-prep-dur {
  position: absolute; top: 6px; right: 8px;
  font-size: 11px; font-weight: 700; color: #ea580c;
  background: rgba(249, 115, 22, 0.12); border: 1px solid #f97316;
  border-radius: 999px; padding: 1px 8px; white-space: nowrap; line-height: 1.4;
}
body.dark .upcoming-prep-dur { color: #fb923c; background: rgba(249, 115, 22, 0.18); }
.upcoming-live-speed { display: flex; align-items: baseline; gap: 10px; font-size: 11px; font-variant-numeric: tabular-nums; }
.upcoming-down { color: #0284c7; font-weight: 700; }
.upcoming-up { color: #94a3b8; }
body.dark .upcoming-live-card { background: #131c31; border-color: #78350f; }
body.dark .upcoming-badge { color: #fbbf24; border-color: #b45309; }
body.dark .upcoming-down { color: #38bdf8; }
body.dark .upcoming-up { color: #64748b; }
.live-room-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
.live-room-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #ef4444;
  animation: livePulse 1.2s infinite;
  flex-shrink: 0;
}
.live-room-card-info {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #64748b;
}
.live-room-mac { font-family: ui-monospace, monospace; }
.live-room-card-start {
  font-size: 10px;
  color: #ef4444;
  margin-top: 2px;
  word-break: break-word;
  overflow-wrap: anywhere;
}
body.dark .live-room-card { background: #0f172a; border-color: #223041; color: #e5eefb; }
body.dark .live-room-card-info { color: #8ea0b8; }
body.dark .live-room-card-start { color: #f87171; }

/* 设备名含中文时允许换行，避免撑破卡片（flex 子项需 min-width:0） */
.live-room-name {
  min-width: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.live-room-suffix {
  font-size: 12px; font-weight: 600; color: #64748b; margin-left: 4px;
}
body.dark .live-room-suffix { color: #94a3b8; }

.live-room-day-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}
.live-room-day-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.live-room-day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  gap: 6px;
}
.live-room-name-wrap { display: flex; align-items: center; gap: 6px; min-width: 0; }
.live-room-day-header span { color: #64748b; font-size: 11px; }
.live-room-day-total { color: #16a34a; font-weight: 700; font-size: 11px; background: #f0fdf4; padding: 2px 8px; border-radius: 999px; border: 1px solid #bbf7d0; }
body.dark .live-room-day-total { background: #052e16; color: #4ade80; border-color: #166534; }
.live-room-day-sessions {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.live-room-day-session {
  background: #f1f5f9;
  color: #475569;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 5px;
  font-family: ui-monospace, monospace;
  word-break: break-word;
  overflow-wrap: anywhere;
}
body.dark .live-room-day-card { background: #0f172a; border-color: #223041; color: #e5eefb; }
body.dark .live-room-day-session { background: #1e293b; color: #94a3b8; }

@media (max-width: 1200px) {
  .live-room-day-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 900px) {
  .live-room-day-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .live-room-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .live-room-card { padding: 8px 9px; font-size: 12px; }
  .live-room-card-top { font-size: 12px; }
  .live-room-card-start { font-size: 9px; }
  .live-room-day-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .live-room-day-card { padding: 8px 9px; font-size: 12px; }
  .live-room-day-header { font-size: 12px; }
  .live-room-day-header span { font-size: 10px; }
  .live-room-day-session { font-size: 10px; padding: 2px 5px; }
  .live-room-day-total { font-size: 10px; padding: 2px 6px; }
  .live-timeline-chip { font-size: 11px; padding: 4px 9px; }
  .live-timeline-chip-count { font-size: 10px; }
  .live-room-ended-tag { font-size: 9px; padding: 1px 6px; }
}
@media (max-width: 420px) {
  .live-room-grid { grid-template-columns: repeat(2, 1fr); }
  .live-room-day-grid { grid-template-columns: repeat(2, 1fr); }
}

/* 近30天 / 近自然月：每天总数条 + 设备时长列表（不显示时间段） */
.live-range-days {
  display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px;
  padding: 8px 10px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px;
}
body.dark .live-range-days { background: #0f172a; border-color: #223041; }
.live-range-day {
  display: inline-flex; flex-direction: column; align-items: center; line-height: 1.15;
  min-width: 38px; padding: 3px 4px; border-radius: 7px;
  font-size: 11px; color: #94a3b8; background: #fff; border: 1px solid #e2e8f0;
}
body.dark .live-range-day { background: #1e293b; border-color: #334155; color: #64748b; }
.live-range-day b { font-size: 13px; font-weight: 800; color: #cbd5e1; margin-top: 1px; }
.live-range-day.has { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.live-range-day.has b { color: #1d4ed8; }
body.dark .live-range-day.has { background: #172554; border-color: #1e40af; color: #93c5fd; }
body.dark .live-range-day.has b { color: #93c5fd; }
/* 可点击：点日期展开当天直播间 */
.live-range-day { cursor: pointer; transition: transform .08s ease, box-shadow .08s ease; }
.live-range-day:hover { box-shadow: 0 1px 4px rgba(37,99,235,.25); transform: translateY(-1px); }
.live-range-day.active { background: #2563eb; border-color: #2563eb; color: #fff; box-shadow: 0 1px 6px rgba(37,99,235,.4); }
.live-range-day.active b { color: #fff; }
body.dark .live-range-day.active { background: #3b82f6; border-color: #3b82f6; }
.live-range-panels { margin-bottom: 4px; }
.live-range-panel { margin-top: 2px; padding-top: 8px; border-top: 1px dashed #e2e8f0; }
body.dark .live-range-panel { border-top-color: #223041; }
.live-range-panel-title { font-size: 13px; font-weight: 700; color: #0f172a; margin: 6px 2px 8px; }
body.dark .live-range-panel-title { color: #e5eefb; }
.live-range-panel-title b { color: #2563eb; margin-left: 2px; }
body.dark .live-range-panel-title b { color: #93c5fd; }
/* 直播间标记 */
/* ============================================================
   Speed heatmap: label alignment helpers
   ============================================================ */
.empty-labels { visibility: hidden; }

/* ============================================================
   Minimal Theme
   ============================================================ */
.minimal-hero {
  padding: 10px 14px;
  background: #fff;
  border: 1px solid #e5e5e7;
  border-radius: 14px;
  margin-bottom: 12px;
}
.minimal-hero-stats {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: #64748b;
  flex-wrap: wrap;
}
.minimal-hero-stats .stat-on { color: #16a34a; font-weight: 700; }
.minimal-hero-stats .stat-off { color: #dc2626; font-weight: 700; }
.minimal-hero-stats .stat-live { color: #16a34a; font-weight: 700; }

.minimal-group-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.minimal-group {
  background: #fff;
  border: 1px solid #e5e5e7;
  border-radius: 14px;
  padding: 10px 12px;
}
.minimal-group-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #f1f5f9;
}
.minimal-group-name {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}
.minimal-group-meta {
  font-size: 11px;
  color: #94a3b8;
}

.minimal-dev-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.minimal-dev-item {
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  cursor: pointer;
  transition: all .15s ease;
}
.minimal-dev-item:hover {
  border-color: #cbd5e1;
  background: #f1f5f9;
}
.minimal-dev-online { border-color: #bbf7d0; background: #f0fdf4; }
.minimal-dev-offline { border-color: #fecaca; background: #fef2f2; }
.minimal-dev-live {
  border-color: #16a34a;
  background: #052e16;
  padding: 4px 6px;
}

.minimal-rec-frame {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #000;
  border: 1px solid #16a34a;
  border-radius: 4px;
  padding: 3px 6px;
  animation: minimalRecPulse 1.4s ease-in-out infinite;
}
@keyframes minimalRecPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.35); border-color: #16a34a; }
  50% { box-shadow: 0 0 8px 2px rgba(34,197,94,0.6); border-color: #4ade80; }
}
.minimal-rec-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ef4444;
  animation: recDotBlink 1s step-end infinite;
  flex-shrink: 0;
}
@keyframes recDotBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}
.minimal-rec-name {
  font-size: 12px;
  font-weight: 600;
  color: #4ade80;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.minimal-rec-suffix {
  font-size: 10px;
  color: #86efac;
  flex-shrink: 0;
}

.minimal-dev-name-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.minimal-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.minimal-status-dot.online { background: #22c55e; }
.minimal-status-dot.offline { background: #ef4444; }
.minimal-dev-name {
  font-size: 12px;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.minimal-dev-suffix {
  font-size: 10px;
  color: #64748b;
  flex-shrink: 0;
}
.minimal-dev-offtime {
  font-size: 10px;
  color: #ef4444;
  margin-top: 2px;
}

body.dark .minimal-hero { background: #0f172a; border-color: #1e293b; }
body.dark .minimal-hero-stats { color: #8ea0b8; }
body.dark .minimal-group { background: #0f172a; border-color: #1e293b; }
body.dark .minimal-group-name { color: #e5eefb; }
body.dark .minimal-dev-item { background: #1e293b; border-color: #334155; }
body.dark .minimal-dev-item:hover { background: #27354f; }
body.dark .minimal-dev-online { border-color: #166534; background: #052e16; }
body.dark .minimal-dev-offline { border-color: #7f1d1d; background: #450a0a; }
body.dark .minimal-dev-name { color: #e5eefb; }
body.dark .minimal-dev-suffix { color: #8ea0b8; }
body.dark .minimal-dev-offtime { color: #f87171; }

@media (max-width: 1200px) {
  .minimal-group-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  .minimal-group-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .minimal-dev-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 360px) {
  .minimal-dev-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   移动端默认主题：设备长条列表（点击展开简版详情）
   仅 ≤640px 生效；电脑端仍走原表格，不受影响
   ============================================================ */
@media (max-width: 640px) {
  .mob-dev-list { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }

  .mob-dev-group {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
  }
  .mob-dev-group-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; padding: 9px 12px;
    background: #f8fafc; border-bottom: 1px solid #eef2f7;
  }
  .mob-dev-group-title {
    font-size: 13px; font-weight: 700; color: #0f172a;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .mob-dev-group-meta { font-size: 11px; color: #64748b; flex-shrink: 0; }

  .mob-dev-item { border-bottom: 1px solid #f1f5f9; }
  .mob-dev-item:last-child { border-bottom: none; }

  /* 长条本体：撑满手机宽度。
     固定 height + 子元素统一 line-height，保证所有行等高（不受字体/内容影响） */
  .mob-dev-bar {
    display: flex; align-items: center; gap: 6px;
    width: 100%; height: 50px; padding: 0 12px;
    box-sizing: border-box; line-height: 1;
    background: transparent; border: none; font: inherit;
    text-align: left; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .mob-dev-bar:active { background: rgba(15, 23, 42, .04); }
  .mob-dev-bar > * { line-height: 1; }
  .mob-dev-bar .status-dot { flex-shrink: 0; }

  .mob-dev-namewrap {
    display: flex; align-items: center; gap: 3px;
    min-width: 0; flex: 0 1 auto;
  }
  .mob-dev-name {
    font-size: 14px; font-weight: 700; color: #0f172a;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    min-width: 0; flex: 0 1 auto;
  }
  .mob-dev-note {
    font-size: 11px; color: #64748b; flex-shrink: 0;
    max-width: 68px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .mob-dev-note.empty { color: #cbd5e1; }
  /* 吃掉剩余空间，把右侧元素推到行尾 */
  .mob-spacer { flex: 1 1 0; min-width: 2px; }

  /* 屏幕异常：红色显示器 logo，闪烁 */
  .mob-screen-alert {
    width: 15px; height: 15px; flex-shrink: 0; color: #dc2626;
    animation: mobAlertBlink 1.5s ease-in-out infinite;
  }
  @keyframes mobAlertBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: .35; }
  }

  /* C 盘容量：圆形百分比环 + 容量文字，颜色随比例变化 */
  .mob-disk { display: inline-flex; align-items: center; gap: 3px; flex-shrink: 0; }
  .mob-disk-ring { position: relative; width: 26px; height: 26px; flex-shrink: 0; }
  .mob-disk-ring svg { width: 100%; height: 100%; display: block; transform: rotate(-90deg); }
  .mob-disk-ring .ring-bg { fill: none; stroke: #e2e8f0; stroke-width: 4.5; }
  .mob-disk-ring .ring-fg { fill: none; stroke-width: 4.5; stroke-linecap: round; }
  .mob-disk-pct {
    position: absolute; top: 0; right: 0; bottom: 0; left: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 9px; font-weight: 800; line-height: 1;
    font-variant-numeric: tabular-nums;
  }
  .mob-disk-cap {
    display: inline-flex; flex-direction: column; align-items: center;
    font-size: 9px; color: #94a3b8; flex-shrink: 0;
    font-variant-numeric: tabular-nums;
    width: 38px; line-height: 1.1;
  }
  .mob-disk-num { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 38px; }
  .mob-disk-bar { width: 100%; height: 1px; background: #cbd5e1; margin: 1px 0; }

  /* CPU / 内存 双横线（上 CPU 蓝、下 内存 紫），位于硬盘圆环前 */
  .mob-cpu-mem {
    display: inline-flex; flex-direction: column; gap: 3px;
    width: 50px; flex-shrink: 0;
  }
  .mob-meter { display: flex; align-items: center; gap: 3px; }
  .mob-meter-lbl {
    font-size: 9px; font-weight: 800; width: 9px; flex-shrink: 0;
    font-variant-numeric: tabular-nums;
  }
  .mob-meter-cpu .mob-meter-lbl { color: #38bdf8; }
  .mob-meter-mem .mob-meter-lbl { color: #a78bfa; }
  .mob-meter-track {
    flex: 1; height: 6px; border-radius: 3px;
    background: #e2e8f0; overflow: hidden;
  }
  .mob-meter-fill { display: block; height: 100%; border-radius: 3px; }
  body.dark .mob-meter-track { background: #1e293b; }

  /* 网速上下行配色同步（下蓝 / 上绿蓝-青） */
  .net-label.down { background: #eff6ff; color: #2563eb; }
  .net-label.up { background: #ecfdf5; color: #0d9488; }
  .net-val { font-weight: 700; font-variant-numeric: tabular-nums; }
  .net-val.down { color: #2563eb; }
  .net-val.up { color: #0d9488; }
  body.dark .net-label.down { background: #132038; color: #93c5fd; }
  body.dark .net-label.up { background: #042f2e; color: #2dd4bf; }
  body.dark .net-val.down { color: #93c5fd; }
  body.dark .net-val.up { color: #2dd4bf; }

  /* 放送中：摄像机绿色闪烁 logo（不带字；详情里的"放送中"文字徽标保持不变） */
  .mob-live-cam {
    width: 15px; height: 15px; flex-shrink: 0; color: #22c55e;
    animation: mobCamBlink 1.4s ease-in-out infinite;
  }
  @keyframes mobCamBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: .25; }
  }
  /* 云手机使用中：手机闪烁 logo，取色同「云手机使用中」徽标 */
  .mob-cloudphone-icon {
    width: 15px; height: 15px; flex-shrink: 0; color: #06b6d4;
    animation: mobCamBlink 1.4s ease-in-out infinite;
  }
  body.dark .mob-cloudphone-icon { color: #67e8f9; }
  /* 展开详情：云手机今日累计使用分钟（使用中高亮，取色同「云手机使用中」） */
  .mob-cloudphone-min { color: #0891b2; font-weight: 600; }
  .mob-cloudphone-min.active { color: #06b6d4; }
  body.dark .mob-cloudphone-min { color: #22d3ee; }
  body.dark .mob-cloudphone-min.active { color: #67e8f9; text-shadow: 0 0 6px rgba(103, 232, 249, .5); }
  .mob-cloudphone-live {
    font-size: 10px; font-weight: 600; color: #06b6d4;
    background: rgba(34, 211, 238, .12);
    border: 1px solid rgba(34, 211, 238, .35);
    padding: 1px 6px; border-radius: 999px; white-space: nowrap;
  }
  body.dark .mob-cloudphone-live { color: #67e8f9; }
  .mob-dev-chevron {
    width: 15px; height: 15px; flex-shrink: 0; color: #94a3b8;
    transition: transform .18s ease;
  }
  .mob-dev-item.expanded .mob-dev-chevron { transform: rotate(180deg); }

  /* 手机端隐藏搜索栏的筛选下拉框：屏幕窄，两个 select 会把搜索框挤到第二行 */
  #status-filter, #group-filter { display: none; }

  /* 展开的简版详情 */
  .mob-dev-detail {
    padding: 6px 12px 12px;
    background: #f8fafc;
    border-top: 1px solid #eef2f7;
    animation: mobFadeIn .16s ease;
  }
  @keyframes mobFadeIn { from { opacity: 0; } to { opacity: 1; } }

  .mob-detail-row {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 0; border-bottom: 1px solid #eef2f7;
  }
  .mob-detail-name-row {
    display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px;
    justify-content: flex-end; text-align: right;
    padding: 2px 0 8px; margin-bottom: 2px;
    border-bottom: 1px solid #e2e8f0;
  }
  .mob-detail-name {
    font-size: 13px; font-weight: 800; color: #0f172a;
    min-width: 0; word-break: break-word; overflow-wrap: anywhere;
  }
  .mob-detail-name-row .homepage-link { margin-left: 0; margin-right: auto; align-self: center; flex-shrink: 0; }
  /* 手机端展开详情：主页 logo 比直播卡大一些（16px，直播卡是 13px），暱称/id 分两行、logo 左侧垂直居中。
     右侧的「位置 / 设备名 / 后缀」维持原样不动。 */
  .mob-detail-name-row .hp-logo { width: 16px; height: 16px; }
  .mob-detail-name-row .hp-stack-txt .hp-nick { font-size: 11px; }
  .mob-detail-name-row .hp-stack-txt .hp-at { font-size: 9px; }
  body.dark .mob-detail-name-row { border-bottom-color: #1e293b; }
  body.dark .mob-detail-name { color: #f1f5f9; }
  .mob-detail-row-stack { align-items: flex-start; }
  .mob-detail-label {
    font-size: 11px; color: #94a3b8; flex-shrink: 0; width: 58px;
  }
  .mob-detail-value {
    font-size: 12px; color: #0f172a; flex: 1; min-width: 0;
    word-break: break-word; line-height: 1.45;
  }
  .mob-detail-sub { font-size: 10px; color: #94a3b8; margin-top: 2px; line-height: 1.35; }
  .mob-muted { color: #94a3b8; }

  .mob-alert-tag {
    display: inline-block; font-size: 10px; font-weight: 700;
    color: #be123c; background: #ffe4e6; padding: 1px 6px; border-radius: 999px;
  }

  .mob-net { font-weight: 700; font-size: 12px; }
  .mob-net.down { color: #2563eb; }
  .mob-net.up { color: #0d9488; }

  /* CPU / 内存：按占比变色（<40 绿 / 40-65 青 / 65-85 橙 / ≥85 红） */
  .mob-pct { font-weight: 700; font-size: 12px; font-variant-numeric: tabular-nums; }
  .mob-pct.ok { color: #16a34a; }
  .mob-pct.mid { color: #0891b2; }
  .mob-pct.warn { color: #f59e0b; }
  .mob-pct.danger { color: #dc2626; }
  .mob-pct.na { color: #94a3b8; }
  body.dark .mob-pct.ok { color: #4ade80; }
  body.dark .mob-pct.mid { color: #22d3ee; }
  body.dark .mob-pct.warn { color: #fbbf24; }
  body.dark .mob-pct.danger { color: #f87171; }
  body.dark .mob-pct.na { color: #64748b; }
  .mob-detail-sub-inline { font-size: 10px; color: #94a3b8; font-weight: 400; }
  body.dark .mob-detail-sub-inline { color: #64748b; }

  /* MAC 复制按钮 */
  .mob-copy-btn {
    display: inline-flex; align-items: center; gap: 5px;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 6px;
    padding: 3px 7px; font: inherit; font-size: 11px; color: #334155;
    cursor: pointer; max-width: 100%;
    -webkit-tap-highlight-color: transparent;
  }
  .mob-copy-btn:active { background: #f1f5f9; }
  .mob-copy-btn.copied { border-color: #22c55e; color: #16a34a; background: #f0fdf4; }
  .mob-copy-icon { width: 12px; height: 12px; flex-shrink: 0; opacity: .55; }
  .mob-copy-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* 直播时间段 */
  .mob-detail-sessions { margin-top: 8px; padding-top: 8px; border-top: 1px solid #eef2f7; }
  .mob-detail-sessions-title { width: auto; display: block; margin-bottom: 5px; }
  .mob-detail-loading { font-size: 11px; color: #94a3b8; }
  .mob-session-list { display: flex; flex-direction: column; gap: 5px; }
  .mob-session-item {
    display: flex; align-items: center; gap: 6px;
    font-size: 11px; color: #334155; line-height: 1.4;
    background: #fff; border: 1px solid #eef2f7; border-radius: 7px; padding: 5px 8px;
  }
  .mob-session-dot { width: 6px; height: 6px; border-radius: 50%; background: #cbd5e1; flex-shrink: 0; }
  .mob-session-dot.live {
    background: #22c55e; box-shadow: 0 0 5px rgba(34, 197, 94, .8);
    animation: liveDot 1.4s ease-in-out infinite;
  }
  .mob-session-time { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mob-session-dur { color: #94a3b8; flex-shrink: 0; }
  .mob-live-now { color: #16a34a; font-weight: 700; }

  /* ---- 深色模式 ---- */
  body.dark .mob-dev-group { background: #0f172a; border-color: #1e293b; }
  body.dark .mob-dev-group-head { background: #131c31; border-color: #1e293b; }
  body.dark .mob-dev-group-title { color: #e2e8f0; }
  body.dark .mob-dev-item { border-color: #1e293b; }
  body.dark .mob-dev-bar:active { background: rgba(255, 255, 255, .04); }
  body.dark .mob-dev-name { color: #e2e8f0; }
  body.dark .mob-dev-note { color: #94a3b8; }
  body.dark .mob-dev-note.empty { color: #475569; }
  body.dark .mob-dev-detail { background: #131c31; border-color: #1e293b; }
  body.dark .mob-detail-row { border-color: #1e293b; }
  body.dark .mob-detail-value { color: #e2e8f0; }
  body.dark .mob-detail-sub,
  body.dark .mob-muted { color: #64748b; }
  body.dark .mob-copy-btn { background: #1e293b; border-color: #334155; color: #cbd5e1; }
  body.dark .mob-copy-btn.copied { background: #14361f; border-color: #22c55e; color: #4ade80; }
  body.dark .mob-session-item { background: #0f172a; border-color: #1e293b; color: #cbd5e1; }
  body.dark .mob-detail-sessions { border-color: #1e293b; }
  body.dark .mob-net.down { color: #60a5fa; }
  body.dark .mob-net.up { color: #2dd4bf; }
  body.dark .mob-disk-ring .ring-bg { stroke: #334155; }
  body.dark .mob-disk-cap { color: #64748b; }
  body.dark .mob-disk-bar { background: #475569; }
  body.dark .mob-screen-alert { color: #f87171; }
  body.dark .mob-alert-tag { background: #3f0d19; color: #fda4af; }
}

/* 推送设置 → 定时日报预览区 */
.daily-report-preview {
  margin: 10px 0 0;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.65;
  color: #334155;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow-y: auto;
}
body.dark .daily-report-preview {
  background: #131c31;
  border-color: #1e293b;
  color: #cbd5e1;
}

/* 推送日志（设置页，最近 24 小时） */
.push-logs { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; max-height: 440px; overflow-y: auto; }
.push-log-item { border: 1px solid rgba(120,140,170,.22); border-radius: 10px; padding: 8px 10px; background: rgba(255,255,255,.02); }
.push-log-head { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #94a3b8; }
.push-log-time { font-variant-numeric: tabular-nums; }
.push-log-type { font-weight: 700; padding: 1px 6px; border-radius: 6px; font-size: 11px; white-space: nowrap; }
.push-log-type.type-device_offline { background: #fee2e2; color: #b91c1c; }
.push-log-type.type-device_online { background: #dcfce7; color: #15803d; }
.push-log-type.type-ip_change { background: #dbeafe; color: #1d4ed8; }
.push-log-type.type-monitor_alert { background: #fef3c7; color: #b45309; }
.push-log-type.type-monitor_recover { background: #dcfce7; color: #15803d; }
.push-log-type.type-group_offline { background: #ffedd5; color: #c2410c; }
.push-log-type.type-cloudphone_usage { background: #cffafe; color: #0e7490; }
.push-log-type.type-daily_report { background: #ede9fe; color: #6d28d9; }
.push-log-type.type-test { background: #e2e8f0; color: #475569; }
.push-log-type.type- { background: #e2e8f0; color: #475569; }
.push-log-dev { margin-left: auto; max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
.push-log-title { margin-top: 4px; font-weight: 600; font-size: 13px; color: #e2e8f0; }
.push-log-content { margin-top: 3px; font-size: 12px; color: #cbd5e1; white-space: pre-wrap; word-break: break-word; }
body.dark .push-log-item { background: rgba(255,255,255,.03); }
body.dark .push-log-title { color: #e2e8f0; }

/* --- 「云手机流量监控」徽标：青色，与 .live-badge / .prep-badge 对称 ---
   非 active 时为静态青色描边（仅标识"选入云手机监控"）；active（使用中）才闪。 */
.cloudphone-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: #0891b2;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid #06b6d4;
  vertical-align: middle;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
  transition: filter .15s ease;
}
.cloudphone-badge:hover { filter: brightness(1.12); text-decoration: underline; }
.cloudphone-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #06b6d4;
  display: inline-block;
  vertical-align: middle;
  margin-right: 2px;
}
.cloudphone-badge.active {
  color: #06b6d4;
  border-color: #22d3ee;
  animation: cpPulse 1s ease-in-out infinite;
  text-shadow: 0 0 8px rgba(34, 211, 238, 0.6);
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.2), inset 0 0 4px rgba(34, 211, 238, 0.08);
}
.cloudphone-badge.active::before {
  background: #22d3ee;
  animation: cpDot 1s ease-in-out infinite;
  box-shadow: 0 0 6px #22d3ee;
}
@keyframes cpPulse {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 10px rgba(34, 211, 238, 0.22), inset 0 0 4px rgba(34, 211, 238, 0.08);
    text-shadow: 0 0 8px rgba(34, 211, 238, 0.6);
  }
  50% {
    opacity: 0.5;
    box-shadow: 0 0 3px rgba(34, 211, 238, 0.08);
    text-shadow: none;
  }
}
@keyframes cpDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.5); opacity: 0.5; }
}
body.dark .cloudphone-badge { color: #22d3ee; border-color: #22d3ee; }
body.dark .cloudphone-badge::before { background: #22d3ee; }
body.dark .cloudphone-badge.active { color: #67e8f9; border-color: #67e8f9; }
body.dark .cloudphone-badge.active::before { background: #67e8f9; box-shadow: 0 0 6px #67e8f9; }

/* 统计栏图例（首页"云手机 X 台"） */
.cloudphone-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #0891b2;
  font-weight: 700;
}
.cloudphone-bottom-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #06b6d4;
  box-shadow: 0 0 6px #06b6d4;
  display: inline-block;
}
body.dark .cloudphone-legend-item { color: #22d3ee; }
body.dark .cloudphone-bottom-dot { background: #22d3ee; box-shadow: 0 0 6px #22d3ee; }

/* 云手机流量专页 */
.cloudphone-summary { margin: 8px 0 14px; }
.cloudphone-summary-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 14px;
  color: #334155;
}
.cloudphone-over-flag {
  color: #dc2626;
  font-weight: 800;
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid #dc2626;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
}
.cloudphone-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.cloudphone-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px;
  background: #fff;
}
.cloudphone-card.active {
  border-color: #22d3ee;
  box-shadow: 0 0 0 1px #22d3ee inset, 0 0 14px rgba(34, 211, 238, 0.18);
}
.cloudphone-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.cloudphone-card-head strong { font-size: 15px; }
.cloudphone-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
}
.cloudphone-card-grid > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cloudphone-k { font-size: 12px; color: #64748b; }
.cloudphone-card-grid strong { font-size: 14px; color: #0f172a; }
.cloudphone-cap { margin-top: 10px; }
.cloudphone-cap-bar {
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}
.cloudphone-cap-fill {
  height: 100%;
  border-radius: 999px;
  background: #06b6d4;
  transition: width 0.3s ease;
}
.cloudphone-cap-fill.over { background: #dc2626; }
.cloudphone-cap-text { font-size: 12px; color: #64748b; margin-top: 4px; }
body.dark .cloudphone-summary-row { color: #cbd5e1; }
body.dark .cloudphone-card { background: #0b1b2e; border-color: #1e3a52; }
body.dark .cloudphone-card.active { border-color: #22d3ee; }
body.dark .cloudphone-k { color: #94a3b8; }
body.dark .cloudphone-card-grid strong { color: #e2e8f0; }
body.dark .cloudphone-cap-bar { background: #1e3a52; }
body.dark .cloudphone-cap-text { color: #94a3b8; }

/* --- 云手机「使用记录」--- */
.cloudphone-usage { margin-top: 4px; display: flex; flex-direction: column; gap: 10px; }
.cp-usage-block {
  border: 1px solid rgba(120,140,170,.2);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(15,23,42,.02);
}
.cp-usage-block.active { border-color: rgba(255,140,0,.5); }
.cp-usage-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.cp-usage-head strong { font-size: 14px; }
.cp-usage-stat { margin-left: auto; font-size: 12px; color: #64748b; text-align: right; }
.cp-seg-list { display: flex; flex-direction: column; }
.cp-seg-row {
  display: flex;
  gap: 14px;
  font-size: 13px;
  padding: 3px 0;
  border-top: 1px dashed rgba(120,140,170,.14);
}
.cp-seg-row:first-child { border-top: none; }
.cp-seg-time { min-width: 168px; color: #334155; font-variant-numeric: tabular-nums; font-family: ui-monospace, Menlo, Consolas, monospace; }
.cp-seg-dur { min-width: 96px; color: #15803d; }
.cp-seg-traffic { color: #64748b; }
body.dark .cp-usage-block { background: rgba(255,255,255,.02); border-color: rgba(120,140,170,.25); }
body.dark .cp-usage-block.active { border-color: rgba(255,140,0,.55); }
body.dark .cp-usage-stat { color: #94a3b8; }
body.dark .cp-seg-time { color: #cbd5e1; }
body.dark .cp-seg-dur { color: #4ade80; }
body.dark .cp-seg-traffic { color: #94a3b8; }
body.dark .cp-seg-row { border-top-color: rgba(120,140,170,.18); }

/* --- 預備中：橙色闪烁 "Ready" 徽标（紧贴设备名 / 用户名之后）--- */
/* 預備中 Ready 标：手机端默认主题折叠条 —— 橙色摄像头、无字、无框、闪烁 */
.mob-prep-cam {
  width: 16px; height: 16px; flex-shrink: 0; margin-left: 6px;
  color: #ea580c;
  animation: prepReadyBlink 1.4s ease-in-out infinite;
}
@keyframes prepReadyBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}
body.dark .mob-prep-cam { color: #fb923c; }

/* 預備中 Ready 标（手机版详情 / 苹果卡共用：橙色摄像头 + Ready Xm） */
.mob-detail-ready {
  display: inline-flex; align-items: center; gap: 5px;
  color: #ea580c; font-weight: 800; font-size: 14px;
  background: rgba(249, 115, 22, 0.12); border: 1px solid #f97316;
  border-radius: 999px; padding: 2px 10px;
  animation: prepReadyBlink 1.4s ease-in-out infinite;
}
.mob-ready-cam { width: 15px; height: 15px; flex-shrink: 0; color: #ea580c; }
body.dark .mob-detail-ready { color: #fb923c; border-color: #fb923c; background: rgba(251, 146, 60, 0.15); }
body.dark .mob-ready-cam { color: #fb923c; }
.apple-dev-ready {
  display: inline-flex; align-items: center; gap: 3px;
  color: #ea580c; font-weight: 800; font-size: 10px; margin-left: 5px; flex-shrink: 0;
  animation: prepReadyBlink 1.4s ease-in-out infinite;
  cursor: pointer;
}
.apple-dev-ready:hover { filter: brightness(1.12); text-decoration: underline; }
.apple-icon-ready { width: 12px; height: 12px; flex-shrink: 0; color: #ea580c; }
body.dark .apple-dev-ready { color: #fb923c; }
body.dark .apple-icon-ready { color: #fb923c; }

/* 云手机 逐设备徽标（Apple 主题，点击跳 Live，与默认主题 cloudphone-badge 同色系） */
.apple-dev-cp {
  display: inline-flex; align-items: center; gap: 3px;
  color: #0891b2; font-weight: 800; font-size: 10px; margin-left: 5px; flex-shrink: 0;
  cursor: pointer;
}
.apple-dev-cp.active { color: #06b6d4; }
.apple-dev-cp:hover { filter: brightness(1.12); text-decoration: underline; }
.apple-icon-cp { width: 12px; height: 12px; flex-shrink: 0; color: #0891b2; }
.apple-dev-cp.active .apple-icon-cp { color: #06b6d4; }
body.dark .apple-dev-cp { color: #22d3ee; }
body.dark .apple-dev-cp.active { color: #67e8f9; }
body.dark .apple-icon-cp { color: #22d3ee; }
body.dark .apple-dev-cp.active .apple-icon-cp { color: #67e8f9; }

/* 最近结束直播 提示（灰色 over 字样，无框无摄像机，与預備中橙色 / 放送中绿色对称） */
.recent-ended-badge {
  display: inline; color: #64748b; font-size: 11px; font-weight: 700;
  vertical-align: middle; letter-spacing: .02em; white-space: nowrap;
}
.recent-ended-badge::before { content: none; }
body.dark .recent-ended-badge { color: #94a3b8; }

.mob-recent-ended-badge {
  display: inline; font-size: 10px; font-weight: 800; letter-spacing: 0.03em;
  color: #64748b; margin-left: 6px; flex-shrink: 0; vertical-align: middle;
}
body.dark .mob-recent-ended-badge { color: #94a3b8; }

.mob-detail-ended {
  display: inline; font-size: 11px; font-weight: 700;
  color: #64748b; margin-left: 6px;
}
body.dark .mob-detail-ended { color: #94a3b8; }

.apple-dev-ended {
  display: inline; color: #64748b; font-weight: 800; font-size: 11px; margin-left: 5px; flex-shrink: 0;
}
body.dark .apple-dev-ended { color: #94a3b8; }

.recent-ended-legend-item { display:inline-flex; align-items:center; gap:6px; color:#64748b; font-weight:600; }
body.dark .recent-ended-legend-item { color:#94a3b8; }
.recent-ended-bottom-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #94a3b8;
}
body.dark .recent-ended-bottom-dot { background: #64748b; }

.recent-ended-dur {
  display:inline-block; font-size:11px; font-weight:700; color:#475569;
  background: rgba(100,116,139,0.14); border:1px solid #94a3b8; border-radius:999px; padding:1px 8px; margin-bottom:6px;
}
body.dark .recent-ended-dur { color:#cbd5e1; border-color:#64748b; background: rgba(148,163,184,0.18); }
.recent-ended-card { border-left: 3px solid #94a3b8 !important; }

/* 手机版折叠条：离线设备标示离线时长 */
.mob-dev-offline {
  display: inline-flex; align-items: center; font-size: 10px; font-weight: 700;
  color: #dc2626; background: rgba(239, 68, 68, 0.12); border: 1px solid #ef4444;
  border-radius: 999px; padding: 1px 7px; margin-left: 6px; flex-shrink: 0;
}
body.dark .mob-dev-offline { color: #f87171; border-color: #ef4444; background: rgba(239, 68, 68, 0.18); }
@media (max-width: 640px) {
  .mob-dev-offline { margin-left: 5px; }
}

/* --- 移动端（≤640px）：隐藏"设备总数/在线/离线/分组"，图例改为独立胶囊避免挤行 --- */
@media (max-width: 640px) {
  .apple-meta-row { display: none; }
  .apple-progress-legend {
    gap: 6px 8px;
    margin-top: 10px;
  }
  .apple-progress-legend > span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    padding: 3px 9px;
    font-size: 12px;
  }
  body.dark .apple-progress-legend > span {
    background: #0b1b2e;
    border-color: #1e3a52;
  }
  .mob-prep-cam { margin-left: 5px; }
}

/* ===== 此站探针（顶部 header，主题选择左侧，线条风，贴顶不撑高） ===== */
.site-probe-bar {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 3px 10px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 10px;
  background: rgba(248, 250, 252, 0.6);
  height: 30px;
  box-sizing: border-box;
  white-space: nowrap;
}
body.dark .site-probe-bar {
  background: rgba(15, 23, 42, 0.5);
  border-color: rgba(51, 65, 85, 0.55);
}
.spb-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.spb-k {
  font-size: 10px;
  color: #64748b;
  letter-spacing: 0.3px;
}
body.dark .spb-k { color: #94a3b8; }
.spb-spark {
  width: 46px;
  height: 18px;
  display: block;
}
.spb-v {
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #0f172a;
  line-height: 1;
}
body.dark .spb-v { color: #e2e8f0; }
.spb-host {
  font-size: 10px;
  color: #94a3b8;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body.dark .spb-host { color: #64748b; }
/* 线条（复用于 header sparkline） */
.sp-line {
  fill: none;
  stroke: #0ea5e9;
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.sp-area {
  fill: rgba(14, 165, 233, 0.12);
  stroke: none;
}
.spb-item:nth-child(2) .sp-line { stroke: #8b5cf6; }
.spb-item:nth-child(2) .sp-area { fill: rgba(139, 92, 246, 0.12); }
/* 手机端收窄：隐藏 host 与运行，避免拥挤换行 */
@media (max-width: 760px) {
  .spb-host { display: none; }
  .spb-uptime { display: none; }
  .site-probe-bar { gap: 9px; padding: 3px 8px; }
  .spb-spark { width: 36px; }
  /* 手机端探针框放宽，避免 CPU/内存 百分比出框 */
  #site-probe { max-width: 82%; flex: 0 0 auto; }
}

/* 当前直播间：自然月记录下拉（最近 3 个自然月可选切换） */
.live-month-select {
  font-size: 12px;
  padding: 2px 6px;
  border: 1px solid #d5dbe3;
  border-radius: 6px;
  background: #fff;
  color: #334155;
  cursor: pointer;
}
body.dark .live-month-select {
  background: #0b1526;
  border-color: #2b3545;
  color: #e5eefb;
}

/* 手机端顶部栏右下角：刷新按钮（默认隐藏，仅手机端显示） */
.mob-refresh-btn { display: none; }
@media (max-width: 640px) {
  .mob-refresh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px; padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 9px;
    background: #f8fafc;
    color: #475569;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform .15s ease, background .15s ease;
  }
  .mob-refresh-btn svg { width: 17px; height: 17px; }
  .mob-refresh-btn:active { transform: scale(.9); }
  .mob-refresh-btn.spinning svg { animation: mobRefreshSpin .7s linear infinite; }
  @keyframes mobRefreshSpin { to { transform: rotate(360deg); } }
  body.dark .mob-refresh-btn {
    background: #0f172a;
    border-color: #1e293b;
    color: #94a3b8;
  }
}

/* 可折叠区块标题（如「最近 8 小时结束的直播间」）：按钮外观贴近普通标题 */
.section-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  user-select: none;
}
.section-toggle:hover .toggle-text { text-decoration: underline; }
.section-toggle .toggle-arrow {
  font-size: 10px;
  line-height: 1;
  color: #64748b;
}
body.dark .section-toggle .toggle-arrow { color: #8ea0b8; }

/* ============================================================
   全屏呼吸灯主题（第四个主题，value=fullscreen）
   原理：取各设备「上一次上报」状态（online/offline/is_live/cloudphone）作为底图，
   在线设备用 CSS 呼吸动画持续「呼吸」，模拟实时跳动。暗色沉浸式。
   ============================================================ */
.fullscreen-dashboard {
  background: #ffffff;
  border-radius: 16px;
  padding: 0;
  margin-top: 14px;
  min-height: calc(100vh - 150px);
  color: #0f172a;
  overflow: hidden;
}
body.fullscreen-theme { background: #eef2f7; }

.fs-bar {
  position: sticky; top: 0; z-index: 6;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 14px 20px;
  background: rgba(255,255,255,.94);
  border-bottom: 1px solid #e2e8f0;
  backdrop-filter: blur(6px);
}
.fs-title { font-size: 17px; font-weight: 800; letter-spacing: .04em; color: #0f172a; }
.fs-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: #64748b; align-items: center; }
.fs-leg::before { content: ''; display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.fs-leg-on::before { background: #22c55e; }
.fs-leg-part::before { background: #f97316; }
.fs-leg-zero::before { background: #ef4444; }
.fs-leg-cur::before { background: transparent; box-shadow: 0 0 0 2px #0284c7; }

.fs-group { margin: 18px 20px; }
.fs-group-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; padding-left: 2px; }
.fs-group-name { font-size: 14px; font-weight: 800; color: #0369a1; letter-spacing: .03em; border-left: 3px solid #0ea5e9; padding-left: 8px; }
.fs-group-meta { font-size: 11px; color: #94a3b8; }

/* 横向滚动容器：每台设备一行，行内一条连续热力图横向铺开，铺满屏幕宽度 */
.fs-scroll { overflow-x: auto; padding-bottom: 6px; }
.fs-inner { width: 100%; min-width: max-content; }
.fs-axis, .fs-device { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 8px; }
.fs-axis { margin-bottom: 4px; }
.fs-device { margin: 5px 0; cursor: pointer; border-radius: 6px; padding: 1px 4px; }
.fs-device:hover { background: rgba(14,165,233,.10); }
.fs-axis-name, .fs-device-name { position: sticky; left: 0; z-index: 2; }
.fs-axis-name { background: #ffffff; }
.fs-device-name { font-size: 11px; font-weight: 600; color: #334155; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: #ffffff; padding-right: 6px; }
.fs-device:hover .fs-device-name { color: #0284c7; }

.fs-strip { display: flex; align-items: center; justify-content: space-between; }
.fs-axis-h { flex: 0 0 16px; width: 16px; font-size: 10px; color: #94a3b8; text-align: center; }
.fs-axis-h.major { color: #475569; font-weight: 700; }
.fs-cell { flex: 0 0 16px; width: 16px; height: 14px; border-radius: 4px; background: #22c55e; }
.fs-cell.on { background: #22c55e; }
.fs-cell.off-zero { background: #ef4444; }
.fs-cell.now { outline: 2px solid #0284c7; outline-offset: 1px; }

/* 深色模式：第四主题（热力图）适配 */
body.dark.fullscreen-theme { background: #03050b; }
body.dark .fullscreen-dashboard { background: #0b0f17; color: #e2e8f0; }
body.dark .fs-bar { background: linear-gradient(180deg, rgba(8,12,22,.96), rgba(8,12,22,.82)); border-bottom-color: rgba(148,163,184,.12); }
body.dark .fs-title { color: #f1f5f9; }
body.dark .fs-legend { color: #94a3b8; }
body.dark .fs-leg-cur::before { box-shadow: 0 0 0 2px #38bdf8; }
body.dark .fs-group-name { color: #7dd3fc; border-left-color: #38bdf8; }
body.dark .fs-group-meta { color: #7c8aa0; }
body.dark .fs-axis-name, body.dark .fs-device-name { background: #0b0f17; color: #cdd9e6; }
body.dark .fs-device:hover { background: rgba(56,189,248,.08); }
body.dark .fs-device:hover .fs-device-name { color: #38bdf8; }
body.dark .fs-axis-h { color: #5b6b80; }
body.dark .fs-axis-h.major { color: #aab8c9; }
body.dark .fs-cell.now { outline-color: #38bdf8; }

/* ===== 机器分布 ===== */
.md-table { display: flex; flex-direction: column; gap: 16px; margin-top: 16px; }
.md-group {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 16px;
  box-shadow: 0 8px 22px rgba(15,23,42,.05);
}
.md-group-head {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; background: linear-gradient(90deg,#eef2ff,#f8fafc);
  border-bottom: 1px solid #e2e8f0;
  border-top-left-radius: 16px; border-top-right-radius: 16px;
}
.md-group-title { font-size: 15px; font-weight: 800; color: #4f46e5; }
.md-row {
  display: grid; grid-template-columns: 160px 1fr; gap: 16px;
  padding: 12px 14px; align-items: start;
  border-bottom: 1px solid #f1f5f9;
}
.md-group .md-row:last-child { border-bottom: none; }
.md-col-a { display: flex; flex-direction: column; gap: 4px; }
.md-rack { font-size: 15px; font-weight: 800; color: #0f172a; }
.md-count { font-size: 11px; color: #64748b; }
.md-col-b { display: flex; flex-direction: column; gap: 10px; }
.md-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 24px; align-items: center; }
.md-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: #eef2ff; color: #3730a3; border: 1px solid #c7d2fe;
  border-radius: 999px; padding: 3px 8px; font-size: 12px; font-weight: 600;
}
.md-chip-x {
  border: none; background: transparent; color: #6d28d9; cursor: pointer;
  font-size: 14px; line-height: 1; padding: 0 2px; border-radius: 999px;
}
.md-chip-x:hover { background: #ddd6fe; }
.md-empty { color: #94a3b8; font-size: 12px; }
.md-add { position: relative; display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.md-add-input { flex: 1; min-width: 140px; max-width: 260px; }
.md-chip-edit { gap: 6px; padding: 2px 6px 2px 8px; }
/* 位置页精准搜索命中的设备：标黄突出，便于在整层里一眼找到 */
.md-chip-hit { background: #fef3c7; color: #92400e; border-color: #f59e0b; }
body.dark .md-chip.md-chip-hit { background: #92400e; color: #fde68a; border-color: #f59e0b; box-shadow: 0 0 0 1px #f59e0b; }
.md-chip-name { white-space: nowrap; }

/* ---- 实时网速页：IP 流量统计（当天 / 近 N 天回查） ---- */
.ip-traffic { margin: 10px 0 14px; }
.ipt-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; cursor: pointer; user-select: none; }
.ipt-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.ipt-toggle { margin-left: 8px; font-size: 11px; font-weight: 600; color: #3b82f6; }
.ipt-collapsed { display: none; }
.ipt-total { font-size: 12px; color: #64748b; }
.ipt-total .up { color: #ef4444; }
.ipt-total .down { color: #16a34a; }
.ipt-table { border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; }
.ipt-row { display: grid; grid-template-columns: minmax(120px, 1.4fr) 80px 50px 1fr 1fr 1fr; gap: 8px; padding: 6px 10px; font-size: 12px; align-items: center; }
.ipt-row + .ipt-row { border-top: 1px solid #eef2f7; }
.ipt-th { background: #f8fafc; font-weight: 700; color: #475569; }
.ipt-ip { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; min-width: 0; }
/* ISP / 地区：显示在 IP 下方的小字，过长省略（悬停看完整） */
.ipt-region { display: block; font-family: inherit; font-size: 11px; font-weight: 400; color: #64748b; margin-top: 1px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.dark .ipt-region { color: #94a3b8; }
.ipt-suffix { font-weight: 700; color: #4338ca; }
/* 最低流量时段表：5 列（IP / 昨日最低 / 昨日流量 / 当日最低 / 当日流量） */
.iqt-row { grid-template-columns: minmax(120px, 1.2fr) 70px 1fr 1fr 1fr 1fr; }

/* ---- 主页核对（homepage-check）---- */
.hc-badge { display:inline-block; margin-left:5px; min-width:16px; padding:0 5px; border-radius:999px; background:#ef4444; color:#fff; font-size:10px; font-weight:700; line-height:16px; text-align:center; vertical-align:middle; }
.hc-section-title { font-size:13px; font-weight:700; margin:12px 0 6px; }
.hc-table { border:1px solid #e2e8f0; border-radius:8px; overflow:hidden; }
.hc-row { display:grid; grid-template-columns: minmax(110px,1.2fr) minmax(110px,1.4fr) 100px 100px minmax(150px,1.7fr) 104px; gap:8px; padding:7px 10px; font-size:12px; align-items:center; }
/* 白名单区块：设备 / 白名单主页 / 当前主页 / 加入时间 / 操作 */
.hc-row.hc-wl-head, .hc-row.hc-wl-row { grid-template-columns: minmax(110px,1.2fr) minmax(110px,1.4fr) 130px 150px 104px; }
.hc-act { text-align:right; }
.hc-wl-btn { padding:3px 8px; border:1px solid #cbd5e1; border-radius:6px; background:#fff; color:#334155; font-size:11px; cursor:pointer; white-space:nowrap; }
.hc-wl-btn:hover { border-color:#6366f1; color:#4338ca; }
.hc-wl-btn.hc-wl-out { border-color:#fca5a5; color:#b91c1c; }
.hc-wl-btn.hc-wl-out:hover { background:#fef2f2; }
.hc-wl-tag { display:inline-block; margin-left:6px; padding:0 6px; border-radius:999px; background:#dcfce7; color:#15803d; font-size:9px; font-weight:700; }
.hc-wl-ok { color:#16a34a; font-size:11px; }
.hc-wl-warn { color:#ea580c; font-size:11px; }
body.dark .hc-wl-btn { background:#1e293b; border-color:#475569; color:#e2e8f0; }
body.dark .hc-wl-btn:hover { border-color:#818cf8; color:#a5b4fc; }
body.dark .hc-wl-btn.hc-wl-out { border-color:#7f1d1d; color:#fca5a5; }
body.dark .hc-wl-tag { background:#14532d; color:#86efac; }
.hc-start b { display:block; font-size:12px; }
.hc-dur { display:block; font-size:10px; color:#64748b; font-weight:400; }
.hc-status-inline { display:block; font-size:10px; color:#94a3b8; font-weight:400; margin-top:2px; }
.hc-live-tag { display:inline-block; padding:0 5px; border-radius:999px; background:#16a34a; color:#fff; font-size:9px; font-weight:700; vertical-align:middle; }
body.dark .hc-dur { color:#94a3b8; }
.hc-row + .hc-row { border-top:1px solid #eef2f7; }
.hc-head { background:#f8fafc; font-weight:700; color:#475569; }
.hc-dev { font-weight:600; }
.hc-time { display:block; font-weight:400; font-size:10px; color:#94a3b8; }
.hc-home a { color:#3b82f6; text-decoration:none; word-break:break-all; }
.hc-note { display:block; font-weight:400; font-size:10px; color:#94a3b8; margin-top:2px; }
.hc-row.hc-mismatch { background:#fef2f2; }
.hc-row.hc-mismatch .hc-diff { color:#ef4444; font-weight:700; }
/* offline = 系统认为在播、TikTok 侧却回报未在直播（橙色，与红色「疑似错误」区分） */
.hc-row.hc-offline { background:#fff7ed; }
.hc-row.hc-offline .hc-diff { color:#ea580c; font-weight:700; }
.hc-row.hc-ok .hc-diff { color:#16a34a; }
.hc-row.hc-unknown { color:#64748b; }
body.dark .hc-table { border-color:#334155; }
body.dark .hc-head { background:#1e293b; color:#cbd5e1; }
body.dark .hc-row + .hc-row { border-top-color:#334155; }
body.dark .hc-row.hc-mismatch { background:#3a1620; }
body.dark .hc-row.hc-offline { background:#3a2410; }
.ipt-row .up { color: #ef4444; }
.ipt-row .down { color: #16a34a; }
.ipt-daily { margin-top: 8px; }
.ipt-daily-title { font-size: 12px; font-weight: 700; color: #475569; margin-bottom: 4px; }
.ipt-daily-list { display: flex; flex-wrap: wrap; gap: 6px; }
.ipt-day { font-size: 11px; padding: 2px 7px; border-radius: 999px; background: #f1f5f9; color: #475569; white-space: nowrap; }
body.dark .ipt-table { border-color: #334155; }
body.dark .ipt-th { background: #1e293b; color: #cbd5e1; }
body.dark .ipt-row + .ipt-row { border-top-color: #334155; }
body.dark .ipt-day { background: #1e293b; color: #cbd5e1; }
body.dark .ipt-total { color: #94a3b8; }
.md-move {
  font-size: 11px; font-weight: 600; color: #4338ca; background: #fff;
  border: 1px solid #c7d2fe; border-radius: 999px; padding: 1px 4px; cursor: pointer;
}
.md-move:focus { outline: 2px solid #38bdf8; outline-offset: 0; }
.md-suggest {
  position: absolute; left: 0; top: calc(100% + 4px); z-index: 100;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
  box-shadow: 0 12px 30px rgba(15,23,42,.18); overflow: hidden; min-width: 200px; max-height: 220px; overflow-y: auto;
}
.md-suggest-item { padding: 7px 12px; font-size: 13px; color: #1e293b; cursor: pointer; }
.md-suggest-item:hover { background: #eef2ff; color: #3730a3; }
.mob-loc-badge {
  display: inline-block; font-size: 11px; font-weight: 700; color: #fff;
  background: #6366f1; border-radius: 8px; padding: 2px 8px; white-space: nowrap;
}
.status-sub.md-loc { color: #4338ca; font-weight: 600; }
.status-sub.md-loc-empty { color: #cbd5e1; }
body.dark .md-group { background: #0e1626; border-color: #223041; box-shadow: 0 8px 22px rgba(0,0,0,.35); }
body.dark .md-group-head { background: linear-gradient(90deg,#172036,#0e1626); border-color: #223041; }
body.dark .md-group-title { color: #a5b4fc; }
body.dark .md-row { border-color: #1a2636; }
body.dark .md-rack { color: #e5eefb; }
body.dark .md-count { color: #8ea0b8; }
body.dark .md-chip { background: #1e293b; color: #c7d2fe; border-color: #334155; }
body.dark .md-chip-x { color: #a5b4fc; }
body.dark .md-chip-x:hover { background: #334155; }
body.dark .md-empty { color: #64748b; }
body.dark .md-move { background: #0b1220; color: #a5b4fc; border-color: #334155; }
body.dark .md-suggest { background: #0e1626; border-color: #223041; box-shadow: 0 12px 30px rgba(0,0,0,.5); }
body.dark .md-suggest-item { color: #cdd9e6; }
body.dark .md-suggest-item:hover { background: #1e293b; color: #c7d2fe; }
body.dark .mob-loc-badge { background: #4f46e5; }
body.dark .status-sub.md-loc-empty { color: #475569; }

/* ===== 第五主题：科技方块（Metro 磁贴风）=====
   方块网格展示设备；每块含 状态灯 / 设备名 / 用户(note) / 后缀 / TikTok(暱称+@id 两行) */
.tiles-hero {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
  padding: 12px 14px; margin-bottom: 14px;
  border: 1px solid #e2e8f0; border-radius: 12px; background: #f8fafc;
}
.tiles-hero-title {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 15px; font-weight: 700; letter-spacing: 0.18em; color: #0f172a;
}
.tiles-hero-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.tiles-stat {
  font-size: 12px; padding: 3px 10px; border-radius: 999px;
  border: 1px solid #e2e8f0; background: #fff; color: #475569;
}
.tiles-stat b { font-size: 13px; margin-right: 4px; color: #0f172a; }
.tiles-stat.on b { color: #16a34a; }
.tiles-stat.off b { color: #dc2626; }
.tiles-stat.live b { color: #0d9488; }

.tiles-group { margin-bottom: 18px; }
.tiles-group-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px; margin-bottom: 8px; padding: 0 2px;
}
.tiles-group-name { font-size: 13px; font-weight: 700; color: #0f172a; }
.tiles-group-meta { font-size: 11px; color: #64748b; }

.tiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 10px;
}

.tile {
  position: relative;
  min-height: 104px;
  padding: 10px 11px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  display: flex; flex-direction: column; gap: 5px;
  cursor: pointer; overflow: hidden;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.tile:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(15, 23, 42, .10); }
/* 左侧状态色条 */
.tile::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: #94a3b8; }
.tile-online::before { background: #22c55e; }
.tile-offline::before { background: #ef4444; }
.tile-live::before { background: #0d9488; }

.tile-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.tile-led {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: #94a3b8; box-shadow: 0 0 0 2px rgba(148, 163, 184, .18);
}
.tile-online .tile-led { background: #22c55e; box-shadow: 0 0 6px rgba(34, 197, 94, .75); }
.tile-offline .tile-led { background: #ef4444; box-shadow: 0 0 6px rgba(239, 68, 68, .55); }
.tile-live .tile-led { background: #0d9488; box-shadow: 0 0 7px rgba(13, 148, 136, .8); animation: tilesPulse 1.3s infinite; }
@keyframes tilesPulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.tile-name {
  font-size: 13px; font-weight: 700; color: #0f172a; line-height: 1.25;
  min-width: 0; word-break: break-word; overflow-wrap: anywhere;
}
.tile-meta { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; min-width: 0; }
.tile-user {
  font-size: 11px; font-weight: 600;
  background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8;
  border-radius: 6px; padding: 1px 6px; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tile-empty { color: #cbd5e1; }
.tile-suffix {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px; color: #64748b; background: #f1f5f9;
  border-radius: 5px; padding: 1px 5px;
}
/* TikTok：logo 在左 + 暱称一行 + @id 一行；无主页时也占位，保持各块高度一致 */
.tile-homepage { margin-top: auto; min-height: 26px; }
.tile-homepage .hp-logo { width: 15px; height: 15px; }
.tile-homepage .hp-stack-txt .hp-nick { font-size: 11px; }
.tile-offtime { font-size: 10px; color: #94a3b8; }

.tile-live { border-color: #5eead4; background: #f0fdfa; }
.tile-offline { background: #fbfbfc; }
.tile-offline .tile-name { color: #64748b; }

/* 暗色适配 */
body.dark .tiles-hero { background: #0f172a; border-color: #223041; }
body.dark .tiles-hero-title { color: #e5eefb; }
body.dark .tiles-stat { background: #131c31; border-color: #223041; color: #94a3b8; }
body.dark .tiles-stat b { color: #e5eefb; }
body.dark .tiles-group-name { color: #e5eefb; }
body.dark .tile { background: #0f172a; border-color: #223041; }
body.dark .tile:hover { box-shadow: 0 6px 18px rgba(0, 0, 0, .45); }
body.dark .tile-name { color: #e5eefb; }
body.dark .tile-user { background: #172554; border-color: #1e40af; color: #93c5fd; }
body.dark .tile-suffix { background: #1e293b; color: #94a3b8; }
body.dark .tile-live { background: #042f2e; border-color: #0f766e; }
body.dark .tile-offline { background: #0d1424; }
body.dark .tile-offline .tile-name { color: #94a3b8; }
body.dark .tile-empty { color: #475569; }

/* 设备右上角 CPU 角标：绝对定位，不占文档流、不改变方块高度 */
.tile-top { padding-right: 46px; }
.tile-cpu {
  position: absolute; top: 9px; right: 9px;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  line-height: 1; pointer-events: none; z-index: 2;
}
.tile-cpu-logo { width: 14px; height: 14px; color: #64748b; display: block; }
.tile-cpu-logo svg { width: 14px; height: 14px; display: block; }
.tile-cpu-txt {
  font-size: 9px; font-weight: 700; color: #475569; letter-spacing: .2px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; white-space: nowrap;
}
body.dark .tile-cpu-logo { color: #94a3b8; }
body.dark .tile-cpu-txt { color: #94a3b8; }

@media (max-width: 640px) {
  .tiles-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .tile { min-height: 96px; padding: 8px 9px; }
}

/* 设置页：可搜索设备组合框 */
.dev-combo { position: relative; }
.dev-combo-input {
  width: 100%; box-sizing: border-box; padding: 8px 10px;
  border: 1px solid var(--border, #d0d7de); border-radius: 8px;
  background: var(--input-bg, #fff); color: var(--text, #1f2937); font-size: 14px;
}
.dev-combo-list {
  position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0;
  max-height: 240px; overflow-y: auto; background: var(--card-bg, #fff);
  border: 1px solid var(--border, #d0d7de); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.14); padding: 4px;
}
.dev-combo-item {
  padding: 7px 9px; border-radius: 6px; cursor: pointer; font-size: 14px; color: var(--text, #1f2937);
}
.dev-combo-item:hover { background: var(--hover-bg, #f1f5f9); }
.dc-note { color: var(--muted, #94a3b8); font-size: 12px; }
.dc-homepage { color: #fe2c55; font-size: 12px; font-weight: 600; }
.dev-combo-empty { padding: 8px 9px; color: var(--muted, #94a3b8); font-size: 13px; }

/* 设置页：清空确认弹窗 */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.45); padding: 16px;
}
.modal-box {
  width: 100%; max-width: 420px; background: var(--card-bg, #fff); color: var(--text, #1f2937);
  border-radius: 12px; padding: 18px 20px; box-shadow: 0 12px 40px rgba(0,0,0,.3);
}
.modal-box h3 { margin: 0 0 8px; }
.modal-box p { margin: 8px 0; line-height: 1.5; }
.modal-dev {
  background: var(--hover-bg, #f1f5f9); border-radius: 8px; padding: 10px 12px; margin: 10px 0;
  font-size: 14px; line-height: 1.7;
}
.modal-box code {
  background: var(--hover-bg, #f1f5f9); padding: 1px 6px; border-radius: 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px;
}
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }

/* ===== 用户统计（按用户聚合机器 / 主页 / 直播天数） ===== */
.us-table { overflow-x: auto; }
.us-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.us-tbl th {
  background: #f1f5f9; color: #334155; font-weight: 700; text-align: left;
  padding: 8px 10px; border-bottom: 1px solid #e2e8f0; white-space: nowrap; font-size: 12px;
}
.us-tbl td { padding: 7px 10px; border-bottom: 1px solid #eef2f7; vertical-align: middle; }
.us-tbl tr.us-group td { background: #eef2ff; border-bottom: 1px solid #dbeafe; padding: 7px 10px; }
.us-tbl tr.us-group-none td { background: #fff7ed; border-bottom: 1px solid #fed7aa; }
.us-uname { font-weight: 700; font-size: 14px; color: #1e293b; margin-right: 10px; }
.us-nouser { color: #b45309; }
.us-gmeta { font-size: 12px; color: #64748b; }
.us-dev:hover td { background: #f8fafc; }
.us-dev-recent td.us-num b { color: #16a34a; }
.us-dev-idle { color: #94a3b8; }
.us-name b { font-size: 13px; }
.us-suffix {
  display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 700;
  color: #4338ca; background: #eef2ff; border-radius: 999px; padding: 1px 6px;
}
.us-sub { display: block; font-size: 11px; color: #94a3b8; }
.us-homepage { max-width: 340px; word-break: break-all; }
.us-hp { color: #2563eb; text-decoration: none; font-size: 12px; }
.us-hp:hover { text-decoration: underline; }
.us-hpname { display: block; font-size: 11px; color: #dc2626; }
.us-num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.us-num b { font-size: 14px; }
.us-time { font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 12px; color: #475569; }
.us-yes { color: #16a34a; font-weight: 700; }
.us-no { color: #94a3b8; }
.us-check { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: #475569; cursor: pointer; }
.us-modal {
  position: fixed; inset: 0; z-index: 9999; display: none;
  align-items: center; justify-content: center; padding: 24px;
  background: rgba(15, 23, 42, .55);
}
.us-modal-card {
  background: #fff; border-radius: 14px; box-shadow: 0 24px 60px rgba(15, 23, 42, .3);
  width: min(1100px, 100%); max-height: 88vh; display: flex; flex-direction: column; overflow: hidden;
}
.us-modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid #e2e8f0;
}
.us-modal-head h3 { margin: 0; font-size: 16px; color: #0f172a; }
.us-modal-body { padding: 14px 18px; overflow: auto; }
.us-modal-foot { padding: 12px 18px; border-top: 1px solid #e2e8f0; display: flex; gap: 10px; justify-content: flex-end; }
body.dark .us-tbl th { background: #1e293b; color: #cbd5e1; border-bottom-color: #334155; }
body.dark .us-tbl td { border-bottom-color: #24334a; color: #dbe4f0; }
body.dark .us-tbl tr.us-group td { background: #1e2a45; border-bottom-color: #334155; }
body.dark .us-tbl tr.us-group-none td { background: #3a2410; border-bottom-color: #4a3418; }
body.dark .us-uname { color: #e5eefb; }
body.dark .us-nouser { color: #fbbf24; }
body.dark .us-dev:hover td { background: #1a2337; }
body.dark .us-suffix { color: #a5b4fc; background: #1e2a45; }
body.dark .us-hp { color: #7dd3fc; }
body.dark .us-time { color: #9fb0c8; }
body.dark .us-dev-idle { color: #64748b; }
body.dark .us-modal-card { background: #0f172a; }
body.dark .us-modal-head { border-bottom-color: #24334a; }
body.dark .us-modal-head h3 { color: #e5eefb; }
body.dark .us-modal-foot { border-top-color: #24334a; }
body.dark .us-check { color: #9fb0c8; }

/* ===== 「设置与其他」聚合入口 ===== */
.nav-card.more-card.more-card-active {
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, .22);
}
.nav-card.more-card.more-card-active strong { color: #4338ca; }
body.dark .nav-card.more-card.more-card-active {
  border-color: #818cf8;
  box-shadow: 0 0 0 2px rgba(129, 140, 248, .3);
}
body.dark .nav-card.more-card.more-card-active strong { color: #a5b4fc; }

/* 用户统计：上月（最近一个完整自然月）直播天数，有值则高亮 */
.us-num .us-pm-hit { color: #4338ca; }
body.dark .us-num .us-pm-hit { color: #a5b4fc; }

/* 用户统计：月份分组之间的竖虚线（区分不同自然月的数值） */
.us-tbl th.us-sep, .us-tbl td.us-sep { border-left: 2px dashed #c7d2e0; }
body.dark .us-tbl th.us-sep, body.dark .us-tbl td.us-sep { border-left-color: #4a5b74; }

/* ---- 推送设置：二级菜单（渠道管理 / iMessage 发送）---- */
.push-subtabs { display:flex; gap:6px; margin:0 0 12px; flex-wrap:wrap; }
.push-tab { padding:5px 14px; border:1px solid #e2e8f0; border-radius:999px; background:#fff; color:#475569; font-size:13px; cursor:pointer; }
.push-tab.active { background:#4338ca; border-color:#4338ca; color:#fff; font-weight:600; }
body.dark .push-tab { background:#111c33; border-color:#334155; color:#cbd5e1; }
body.dark .push-tab.active { background:#4338ca; border-color:#4338ca; color:#fff; }

/* ---- iMessage 推送格式编辑卡片 ---- */
.im-fmt-card { padding:12px 14px; border:1px solid #e2e8f0; border-radius:8px; margin-bottom:12px; background:#fff; }
.im-fmt-head { display:flex; gap:10px; align-items:baseline; flex-wrap:wrap; margin-bottom:8px; }
.im-fmt-row { display:flex; gap:10px; align-items:flex-start; margin-bottom:8px; flex-wrap:wrap; }
.im-fmt-label { min-width:72px; font-size:12px; color:#64748b; padding-top:5px; }
.im-fmt-fields { display:flex; flex-wrap:wrap; gap:4px 14px; flex:1; }
.im-fmt-field { font-size:12px; color:#334155; cursor:pointer; }
.im-fmt-actions { gap:8px; align-items:center; }
.im-fmt-status { font-size:12px; }
.im-grp { border:1px solid #eef2f7; border-radius:8px; padding:10px 12px; margin:10px 0; background:#f8fafc; }
.im-grp-title { font-weight:600; font-size:13px; color:#334155; margin-bottom:8px; display:flex; justify-content:space-between; align-items:center; gap:10px; }
body.dark .im-grp { background:#111a2b; border-color:#334155; }
body.dark .im-grp-title { color:#e2e8f0; }
.im-fmt-preview { margin:8px 0 0; padding:10px 12px; background:#f8fafc; border:1px solid #e2e8f0; border-radius:6px; font-size:12px; white-space:pre-wrap; word-break:break-all; }
body.dark .im-fmt-card { background:#0b1220; border-color:#334155; }
body.dark .im-fmt-field { color:#cbd5e1; }
body.dark .im-fmt-label { color:#94a3b8; }
body.dark .im-fmt-preview { background:#111c33; border-color:#334155; color:#e2e8f0; }
