/* =============================================================
   手机外壳 / 状态栏 / 标题栏 / 页面 / 底部标签栏 / Sheet / Toast
   ============================================================= */

/* 桌面预览：桌布背景 + 手机外壳 */
.stage {
  width: var(--pw); height: var(--ph);
  position: relative;
  background: var(--bg-app);
  border-radius: 46px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .32), 0 0 0 10px #1c1e22, 0 0 0 11px #3a3d44;
  display: flex; flex-direction: column;
  transition: background var(--dur) var(--ease);
}
[data-theme="dark"] .stage { box-shadow: 0 30px 80px rgba(0, 0, 0, .6), 0 0 0 10px #26282d, 0 0 0 11px #464a52; }

/* 真机/窄屏：铺满全屏，去掉外壳 */
@media (max-width: 520px), (max-height: 880px) and (max-width: 700px) {
  body { display: block; background: var(--bg-app); }
  .stage {
    width: 100vw; height: 100vh; height: 100dvh;
    border-radius: 0; box-shadow: none;
  }
}
@media (max-height: 700px) {
  body { display: block; }
  .stage { border-radius: 0; box-shadow: none; width: 100vw; height: 100vh; }
}

/* ============================== 状态栏 ============================== */
.statusbar {
  height: var(--safe-t); flex: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 26px 0;
  font-size: 14px; font-weight: 600; color: var(--status-fg);
  position: relative; z-index: 40;
}
.statusbar .notch {
  position: absolute; left: 50%; top: 9px; transform: translateX(-50%);
  width: 116px; height: 30px; border-radius: 16px; background: #101216;
}
[data-theme="dark"] .statusbar .notch { background: #000; }
.statusbar .sb-r { display: flex; align-items: center; gap: 5px; }
.statusbar .batt {
  width: 24px; height: 12px; border-radius: 3.5px;
  border: 1px solid currentColor; opacity: .9; position: relative;
}
.statusbar .batt::after {
  content: ""; position: absolute; inset: 1.5px; width: 72%;
  background: currentColor; border-radius: 1.5px;
}
@media (max-width: 520px) { .statusbar { display: none; } }

/* ============================== 标题栏 ============================== */
.navbar {
  height: var(--nav-h); flex: none;
  display: flex; align-items: center; gap: var(--sp-2);
  padding: 0 var(--edge);
  position: relative; z-index: 30;
}
.navbar .nb-t { font-size: 17px; font-weight: 650; letter-spacing: -.2px; }
.navbar .nb-r { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.navbar .nb-b {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; color: var(--tx-2);
  background: var(--bg-raise);
  transition: all var(--dur-fast) var(--ease);
}
.navbar .nb-b:active { background: var(--bg-hover); }
.navbar .nb-b.on { color: var(--brand); background: var(--brand-soft); }
.navbar.ghost { background: transparent; }

/* Large Title（首页） */
.large-title {
  padding: 2px var(--edge) 10px;
  font-size: 32px; font-weight: 750; letter-spacing: -1px;
  display: flex; align-items: flex-end; gap: var(--sp-3);
  flex-wrap: nowrap;
}
/* 标题文字不参与收缩，避免被长副标题挤成竖排两行 */
.large-title > b, .large-title > .lt-t { flex: 0 0 auto; white-space: nowrap; font-weight: inherit; }
.large-title .lt-sub {
  font-size: 14px; font-weight: 500; color: var(--tx-3); padding-bottom: 6px;
  min-width: 0; line-height: 1.35;
}

/* ============================== 页面容器 ============================== */
.screens { flex: 1; min-height: 0; position: relative; }
.screen {
  position: absolute; inset: 0;
  display: none; flex-direction: column;
}
.screen.active { display: flex; animation: fade-up 220ms var(--ease) both; }
.sc-body {
  flex: 1; min-height: 0; overflow: auto;
  padding-bottom: calc(var(--sp-6) + 8px);
  -webkit-overflow-scrolling: touch;
}

/* ============================== 底部标签栏 ============================== */
.tabbar {
  flex: none; height: calc(var(--tab-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; grid-template-columns: none;
  background: var(--bg-group);
  border-top: 1px solid var(--line-1);
  position: relative; z-index: 30;
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; font-size: 10.5px; color: var(--tx-3);
  transition: color var(--dur-fast) var(--ease);
  position: relative;
}
.tab .ic { width: 23px; height: 23px; }
.tab.on { color: var(--brand); font-weight: 600; }
.tab .dot {
  position: absolute; top: 6px; right: calc(50% - 18px);
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--r-pill);
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
  display: grid; place-items: center; font-family: var(--font-mono);
  border: 1.5px solid var(--bg-group);
}
.tab:active { opacity: .6; }

/* ============================== Sheet（全屏详情） ============================== */
.sheet {
  position: absolute; inset: 0; z-index: 60;
  background: var(--bg-app);
  display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: transform var(--dur) var(--ease);
  box-shadow: var(--sh-3);
}
.sheet.show { transform: none; }
.sheet-head {
  flex: none; display: flex; align-items: center; gap: var(--sp-2);
  height: var(--nav-h); padding: 0 var(--edge);
  border-bottom: 1px solid var(--line-1);
  background: var(--bg-group);
}
.sheet-head h3 { font-size: 17px; font-weight: 650; flex: 1; text-align: center; }
.sheet-head .sh-b { width: 34px; height: 34px; display: grid; place-items: center; color: var(--tx-2); border-radius: 50%; }
.sheet-head .sh-b.strong { color: var(--brand); font-weight: 600; font-size: 16px; width: auto; }
.sheet-body { flex: 1; min-height: 0; overflow: auto; padding-bottom: 96px; }
.sheet-foot {
  flex: none; padding: var(--sp-3) var(--edge) calc(var(--sp-3) + var(--safe-b));
  display: flex; gap: var(--sp-3);
  background: var(--bg-group); border-top: 1px solid var(--line-1);
}
.sheet-foot .btn { flex: 1; }

/* ============================== Toast ============================== */
.toasts {
  position: absolute; top: calc(var(--safe-t) + 6px); left: var(--edge); right: var(--edge);
  z-index: 300; display: flex; flex-direction: column; gap: var(--sp-2); pointer-events: none;
}
.toast {
  padding: 11px 14px; border-radius: var(--r-md);
  background: var(--bg-group); box-shadow: var(--sh-3);
  display: flex; align-items: flex-start; gap: 9px;
  animation: toast-in var(--dur) var(--ease) both;
}
.toast b { display: block; font-size: 13.5px; font-weight: 650; }
.toast span { font-size: 12.5px; color: var(--tx-2); }
.toast .ic { margin-top: 1px; }
.toast.critical { background: var(--danger-soft); }
.toast.critical b { color: var(--danger); }
.toast.ok .ic { color: var(--ok); }

/* ============================== 悬浮按钮 ============================== */
.fab {
  position: absolute; right: var(--edge); z-index: 35;
  bottom: calc(var(--tab-h) + var(--safe-b) + 16px);
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 6px 18px rgba(10, 132, 255, .34);
}
.fab:active { opacity: .8; }
.fab .ic { width: 24px; height: 24px; stroke-width: 2.2; }

/* ============================== 导航栏铃铛角标 ============================== */
.navbar .nb-b { position: relative; }
.navbar .nb-dot {
  position: absolute; top: 1px; right: 0;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: var(--r-pill); background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; font-style: normal; line-height: 1;
  display: grid; place-items: center; font-family: var(--font-mono);
  border: 1.5px solid var(--bg-app);
}

/* ============================== 预警消息弹窗（浮层） ============================== */
.alarm-pop {
  position: absolute; left: var(--edge); right: var(--edge);
  top: calc(var(--safe-t) + 10px); z-index: 260;
  animation: ap-in 260ms var(--ease) both;
}
.alarm-pop[hidden] { display: none; }
.alarm-pop .ap-card {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 13px; border-radius: var(--r-lg);
  background: var(--bg-group);
  border: 1px solid var(--danger-line);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .18);
}
.alarm-pop .ap-ic { color: var(--danger); flex: none; margin-top: 1px; }
.alarm-pop .ap-main { flex: 1; min-width: 0; }
.alarm-pop .ap-t { font-size: 13.5px; font-weight: 700; color: var(--tx-1); }
.alarm-pop .ap-d { font-size: 12px; color: var(--tx-2); margin-top: 2px; line-height: 1.45; }
.alarm-pop .ap-go {
  margin-top: 8px; align-self: flex-start;
  padding: 6px 12px; border-radius: var(--r-pill);
  background: var(--brand); color: #fff; font-size: 12px; font-weight: 650;
}
.alarm-pop .ap-x {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; color: var(--tx-3);
  background: var(--bg-raise);
}
@keyframes ap-in {
  from { opacity: 0; transform: translateY(-14px); }
  to { opacity: 1; transform: none; }
}
