/* 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; }

/* --- 「預備中」徽标：首页「状况」列里紧挨「放送中」显示 ---
   形态与 .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;
}
.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: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.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-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;
}

/* ===== 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-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-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; }

/* 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; }

/* 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: 140px;
}
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);
}
.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; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 14px;
}
.apple-dev-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 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;
}
.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; }
.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); }
.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; }

/* 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;
}
@media (max-width: 1400px) {
  .apple-group-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1100px) {
  .apple-group-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  /* 手机端：一个分组占满整行，区域内 3 列设备。
     相比原来的「2 分组 × 2 列」，每行设备数从 4 减到 3，
     单格宽度从 ~73px 增到 ~110px，避免设备名/后缀挤压换行。 */
  .apple-group-grid { grid-template-columns: 1fr; }
  .apple-dev-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px 6px; }
  .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 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px 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;
}
.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:center;
  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; }
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: 12px;
  height: 12px;
  border-radius: 3px;
  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; }
}

.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;
}
.live-timeline-hour-labels,
.live-timeline-bars {
  display:grid;
  grid-template-columns: repeat(var(--timeline-cols, 24), minmax(0, 1fr));
  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; }
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: 14px 12px 10px; position: relative; }
  .toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .toolbar .row { justify-content: flex-end; }
  .title { font-size: 17px; }
  .tabs { flex-wrap: wrap; gap: 4px; }
  .tab { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
  .theme-select { font-size: 12px; padding: 6px 8px; min-height: 34px; }
  .lang-select { font-size: 12px; padding: 6px 8px; min-height: 34px; max-width: 130px; 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; }

  /* ---- 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: 22px;
  border-radius: 6px;
  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; }
.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;
}
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;
}

/* 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-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;
}
.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); }
}

/* ============================================================
   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-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; }
  }
  .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-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;
}
