/* 智能对讲 · 主机 A 配套 APP（移动端 Web）
   默认页为计算器；管理页仅在暗码校验通过后挂载。 */
:root {
  --bg: #F4F5F7;
  --card: #FFFFFF;
  --text: #1B2430;
  --muted: #7A8798;
  --line: #E7EBF1;
  --navy: #1F3864;
  --blue: #2E75B6;
  --blue-soft: #EAF2FB;
  --green: #2E7D32;
  --amber: #ED6C02;
  --red: #C62828;
  --shadow: 0 2px 10px rgba(24, 39, 75, .06);
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: #E8ECF2;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  overscroll-behavior: none;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { border: 0; background: none; padding: 0; cursor: pointer; }
svg { display: block; }
.hidden { display: none !important; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* ============================ 计算器 ============================ */
.calc-view {
  position: fixed;
  inset: 0;
  margin: 0 auto;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  background: #E9EDF3;
  color: #16181C;
  z-index: 5;
  user-select: none;
  font-family: "HarmonyOS Sans SC", "HarmonyOS Sans", "Huawei Sans", "Helvetica Neue", Arial, sans-serif;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}
.calc-tools {
  flex: 0 0 auto;
  height: calc(62px + env(safe-area-inset-top, 0px));
  padding: calc(18px + env(safe-area-inset-top, 0px)) 27px 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.calc-menu {
  display: grid;
  grid-template-columns: repeat(2, 4px);
  grid-template-rows: repeat(2, 4px);
  gap: 9px 8px;
  opacity: .5;
}
.calc-menu i { width: 4px; height: 4px; border-radius: 1px; background: #4E5968; }
.calc-display {
  flex: 1 1 auto;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-end;
  padding: 8px 28px 24px;
  overflow: hidden;
}
.calc-expr {
  min-height: 24px;
  font-size: 16px;
  color: #8B95A5;
  letter-spacing: .3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.calc-value {
  font-size: clamp(48px, 15vw, 76px);
  font-weight: 300;
  letter-spacing: -1.5px;
  line-height: 1.08;
  white-space: nowrap;
  overflow: hidden;
  max-width: 100%;
  transition: font-size .12s ease;
  font-variant-numeric: tabular-nums;
}
.calc-value.shrink-1 { font-size: clamp(36px, 11.5vw, 54px); }
.calc-value.shrink-2 { font-size: clamp(29px, 9vw, 42px); }
.calc-value.error { font-size: 40px; color: #C62828; font-weight: 400; }
.calc-keys {
  --key-reserve: 324px;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(6, auto);
  gap: clamp(8px, 1.8vh, 16px) clamp(10px, 3vw, 16px);
  padding: 24px clamp(18px, 5vw, 28px) calc(22px + var(--safe-b));
  background: #F5F6FA;
  border-radius: 32px 32px 0 0;
  box-shadow: 0 -1px 0 rgba(255, 255, 255, .65);
}
.ck {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: min(100%, 96px, calc((100vh - var(--key-reserve)) / 6));
  width: min(100%, 96px, calc((100dvh - var(--key-reserve)) / 6));
  max-width: 96px;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 1;
  justify-self: center;
  align-self: center;
  border-radius: 50%;
  background: #FFFFFF;
  color: #16181C;
  font-size: clamp(32px, 9.3vw, 44px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 5px 12px rgba(39, 52, 72, .07), 0 1px 2px rgba(39, 52, 72, .04);
  transition: transform .14s cubic-bezier(.2, .8, .2, 1), background-color .12s ease, box-shadow .14s ease;
  touch-action: manipulation;
}
.ck::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(77, 99, 128, .16);
  opacity: 0;
  transform: scale(.65);
  transition: opacity .16s ease, transform .2s ease;
  pointer-events: none;
}
.ck.pressed {
  transform: scale(.9);
  background: #EDF1F6;
  box-shadow: 0 1px 3px rgba(39, 52, 72, .06);
  transition-duration: .06s;
}
.ck.pressed::after { opacity: 1; transform: scale(1); transition-duration: .05s; }
.ck svg { position: relative; z-index: 1; }
.ck.fn {
  color: #50545B;
  font-size: clamp(24px, 6.5vw, 32px);
  font-weight: 400;
  letter-spacing: -.5px;
}
.ck.op {
  color: #0867D7;
  font-size: clamp(34px, 9.3vw, 44px);
  font-weight: 400;
  letter-spacing: 0;
}
.ck[data-key="C"] { font-size: clamp(32px, 8.7vw, 42px); }
.ck[data-key="←"] svg { width: clamp(30px, 7.4vw, 36px); height: clamp(30px, 7.4vw, 36px); stroke-width: 1.7; }
.ck[data-key="."] { font-size: clamp(36px, 10vw, 48px); }
.ck.eq {
  grid-column: 4;
  grid-row: 5 / span 2;
  align-self: stretch;
  height: 100%;
  max-height: none;
  aspect-ratio: auto;
  border-radius: 999px;
  background: #0B5EDB;
  color: #FFF;
  font-size: clamp(30px, 8vw, 38px);
  font-weight: 300;
  box-shadow: 0 6px 14px rgba(11, 94, 219, .2);
}
.ck.eq.pressed { background: #084FB9; transform: scale(.94); }
.ck.eq::after { background: rgba(0, 27, 77, .16); }

@media (max-height: 720px) {
  .calc-tools { height: calc(44px + env(safe-area-inset-top, 0px)); padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
  .calc-display { min-height: 104px; padding-bottom: 12px; }
  .calc-value { font-size: clamp(40px, 8vh, 56px); }
  .calc-keys { --key-reserve: 210px; gap: 7px 10px; padding-top: 14px; padding-bottom: calc(12px + var(--safe-b)); border-radius: 24px 24px 0 0; }
}

/* ============================ APP 框架 ============================ */
.app-view {
  position: fixed;
  inset: 0;
  margin: 0 auto;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  z-index: 6;
  overflow: hidden;
}
.app-top {
  flex: 0 0 60px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px 0 12px;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--line);
  z-index: 3;
  padding-top: env(safe-area-inset-top, 0px);
  height: calc(60px + env(safe-area-inset-top, 0px));
}
.app-title { display: flex; align-items: center; gap: 9px; min-width: 0; flex: 1; }
.app-title-text { min-width: 0; }
.app-title-main {
  font-size: 16px; font-weight: 700; letter-spacing: .2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.app-title-sub { font-size: 10.5px; color: var(--muted); margin-top: 1px; letter-spacing: .2px; }
.app-actions { display: flex; align-items: center; gap: 2px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  color: #4A586B; position: relative; flex: 0 0 auto;
}
.icon-btn:active { background: #EFF3F8; }
.icon-btn.back { color: var(--blue); }
.badge {
  position: absolute; top: 4px; right: 3px; min-width: 15px; height: 15px;
  padding: 0 4px; border-radius: 8px; background: var(--red); color: #fff;
  font-size: 9px; font-weight: 700; display: flex; align-items: center; justify-content: center;
  border: 1.5px solid #fff;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: #B7C0CC; flex: 0 0 auto; }
.dot.online { background: var(--green); box-shadow: 0 0 0 3px rgba(46, 125, 50, .12); }
.dot.suspect { background: var(--amber); }
.dot.offline { background: var(--red); }
.dot.unknown { background: #B7C0CC; }

.banner {
  margin: 10px 14px 0;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.5;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.banner.warn { background: #FFF6E8; color: #8A5300; border: 1px solid #FFE2B8; }
.banner.info { background: var(--blue-soft); color: #1C4E80; border: 1px solid #D3E5F8; }
.banner.danger { background: #FFF0EF; color: #9B1C1C; border: 1px solid #F6D3D0; }

.page-host {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 14px calc(20px + 64px + var(--safe-b));
  scrollbar-width: none;
}
.page-host::-webkit-scrollbar { display: none; }
.page-host.no-tabs { padding-bottom: calc(24px + var(--safe-b)); }

.tabbar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(255, 255, 255, .98);
  border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + var(--safe-b));
  z-index: 3;
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: #8794A7; font-size: 10.5px; padding: 4px 0 2px; border-radius: 10px;
}
.tab svg { color: #93A1B4; }
.tab.on { color: var(--blue); font-weight: 700; }
.tab.on svg { color: var(--blue); }

/* ============================ 通用组件 ============================ */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 15px;
  margin-bottom: 12px;
}
.card.tight { padding: 12px 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-title { font-size: 14px; font-weight: 700; letter-spacing: .2px; }
.card-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.card-link { font-size: 11.5px; color: var(--blue); font-weight: 600; display: flex; align-items: center; gap: 2px; }
.section-title { font-size: 12px; color: var(--muted); font-weight: 600; margin: 18px 2px 8px; letter-spacing: .3px; }
.divider { height: 1px; background: var(--line); margin: 12px 0; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.muted { color: var(--muted); }
.small { font-size: 11.5px; }
.tiny { font-size: 10.5px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.flex { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.btn {
  height: 44px; padding: 0 16px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 14px; font-weight: 600; background: #F0F3F7; color: #364356;
  transition: transform .06s ease, filter .1s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(.985); filter: brightness(.97); }
.btn.primary { background: var(--blue); color: #fff; box-shadow: 0 6px 16px rgba(46, 117, 182, .26); }
.btn.navy { background: var(--navy); color: #fff; }
.btn.ghost { background: #fff; border: 1px solid var(--line); color: #3C4A5C; }
.btn.danger { background: #FFF2F1; color: var(--red); border: 1px solid #F3D5D2; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 12.5px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn:disabled, .btn.disabled { opacity: .45; pointer-events: none; box-shadow: none; }
.btn .spin {
  width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite;
}
.btn.ghost .spin { border-color: rgba(46,117,182,.25); border-top-color: var(--blue); }
@keyframes spin { to { transform: rotate(360deg); } }

.pill {
  display: inline-flex; align-items: center; gap: 4px;
  height: 21px; padding: 0 8px; border-radius: 6px;
  font-size: 10.5px; font-weight: 600; background: #F1F4F8; color: #5A6A7D;
  white-space: nowrap;
}
.pill.green { background: #EAF5EA; color: #2E7D32; }
.pill.amber { background: #FFF3E3; color: #B45309; }
.pill.red { background: #FDECEA; color: #B3261E; }
.pill.blue { background: #EAF2FB; color: #1F5F9E; }
.pill.grey { background: #F1F4F8; color: #667085; }
.pill.dark { background: rgba(255,255,255,.16); color: #fff; }

/* ---------------- 概览 ---------------- */
.hero {
  position: relative;
  border-radius: 18px;
  padding: 17px 16px;
  color: #fff;
  background: linear-gradient(135deg, #1F3864 0%, #245089 58%, #2E75B6 100%);
  box-shadow: 0 10px 24px rgba(31, 56, 100, .22);
  display: flex;
  align-items: center;
  gap: 16px;
  overflow: hidden;
  margin-bottom: 12px;
}
.hero:after {
  content: ""; position: absolute; right: -40px; top: -60px;
  width: 170px; height: 170px; border-radius: 50%;
  background: rgba(255,255,255,.07);
}
.hero-ring {
  --p: 60%;
  width: 94px; height: 94px; border-radius: 50%;
  background: conic-gradient(#8EC5FF var(--p), rgba(255,255,255,.17) 0);
  display: grid; place-items: center; flex: 0 0 auto;
  transition: background .4s ease;
}
.hero-ring-inner {
  width: 76px; height: 76px; border-radius: 50%; background: #23457A;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.hero-count { font-size: 27px; font-weight: 700; line-height: 1; letter-spacing: -.5px; }
.hero-count small { font-size: 14px; font-weight: 500; opacity: .8; }
.hero-count-label { font-size: 9.5px; opacity: .72; margin-top: 3px; letter-spacing: .5px; }
.hero-body { flex: 1; min-width: 0; position: relative; z-index: 1; }
.hero-name { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-meta { display: flex; align-items: center; gap: 6px; font-size: 10.5px; opacity: .78; margin-top: 3px; }
.hero-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin-top: 10px; font-size: 11px; }
.hero-stats b { font-size: 14px; font-weight: 700; margin-right: 3px; }
.hero-updated { font-size: 9.5px; opacity: .62; margin-top: 9px; }
.hero.offline { background: linear-gradient(135deg, #3A4658, #59677C); }

.device-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.device-item { min-width: 0; }
.device-item .k { font-size: 10.5px; color: var(--muted); margin-bottom: 2px; }
.device-item .v { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.signal { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; margin-left: 4px; vertical-align: -1px; }
.signal i { width: 3px; background: #D6DEE8; border-radius: 1px; }
.signal i:nth-child(1) { height: 4px; } .signal i:nth-child(2) { height: 7px; }
.signal i:nth-child(3) { height: 10px; } .signal i:nth-child(4) { height: 14px; }
.signal i.on { background: var(--green); }
.signal.weak i.on { background: var(--amber); }
.signal.bad i.on { background: var(--red); }

.slot-chips { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.slot-chip {
  border: 1px solid var(--line); border-radius: 11px; padding: 8px 2px 7px;
  background: #FBFCFE; text-align: center; position: relative; min-width: 0;
}
.slot-chip .n { font-size: 12px; font-weight: 700; color: #3A4759; }
.slot-chip .b { font-size: 10px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.slot-chip .sd { width: 6px; height: 6px; border-radius: 50%; margin: 4px auto 0; background: #B7C0CC; }
.slot-chip.online { background: #F4FAF4; border-color: #D9EDD9; }
.slot-chip.online .sd { background: var(--green); }
.slot-chip.suspect { background: #FFFAF1; border-color: #F8E4C6; }
.slot-chip.suspect .sd { background: var(--amber); }
.slot-chip.offline { background: #FAFBFC; }
.slot-chip.offline .sd { background: #9AA6B5; }
.slot-chip.unauthorized { background: #FFF4F3; border-color: #F3D3D0; }
.slot-chip.unauthorized .sd { background: var(--red); }
.slot-chip.empty { border-style: dashed; background: transparent; }
.slot-chip.empty .n { color: #B3BDCB; }
.slot-chip.unknown { opacity: .62; }

.alarm-mini { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.alarm-mini:last-child { border-bottom: 0; padding-bottom: 2px; }
.alarm-mini .ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: 0 0 auto; background: #FFF3E3; color: #B45309; }
.alarm-mini.high .ic { background: #FDECEA; color: #B3261E; }
.alarm-mini.low .ic { background: #EEF2F7; color: #5A6A7D; }
.alarm-mini .t { font-size: 12.5px; font-weight: 600; line-height: 1.35; }
.alarm-mini .m { font-size: 11px; color: var(--muted); margin-top: 2px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.alarm-mini .time { font-size: 10px; color: #A0ACBB; margin-left: auto; padding-top: 2px; white-space: nowrap; }
.empty-mini { padding: 14px 0; text-align: center; color: var(--muted); font-size: 12px; }

/* ---------------- 耳塞 ---------------- */
.summary-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.summary-cell { background: var(--card); border-radius: 12px; padding: 10px 4px; text-align: center; box-shadow: var(--shadow); }
.summary-cell b { display: block; font-size: 19px; font-weight: 700; line-height: 1.1; }
.summary-cell span { font-size: 10px; color: var(--muted); }
.summary-cell.green b { color: var(--green); } .summary-cell.amber b { color: var(--amber); }
.summary-cell.red b { color: var(--red); } .summary-cell.grey b { color: #667085; }

.ear-row {
  display: flex; align-items: center; gap: 11px; padding: 12px 2px;
  border-bottom: 1px solid var(--line); width: 100%; text-align: left;
}
.ear-row:last-child { border-bottom: 0; }
.ear-row:active { background: #FAFBFD; }
.ear-avatar {
  width: 40px; height: 40px; border-radius: 12px; flex: 0 0 auto;
  background: #F1F4F8; color: #55657A; display: grid; place-items: center;
  font-size: 14px; font-weight: 700; position: relative;
}
.ear-avatar.online { background: #EAF5EA; color: var(--green); }
.ear-avatar.offline { background: #F2F4F7; color: #98A4B3; }
.ear-avatar.unauthorized { background: #FDECEA; color: var(--red); }
.ear-avatar.empty { background: #F8F9FB; color: #C0C8D3; border: 1px dashed #DCE3EC; }
.ear-avatar .ind { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid #fff; background: #B7C0CC; }
.ear-avatar.online .ind { background: var(--green); }
.ear-avatar.offline .ind { background: #9AA6B5; }
.ear-avatar.unauthorized .ind { background: var(--red); }
.ear-avatar.suspect .ind { background: var(--amber); }
.ear-main { flex: 1; min-width: 0; }
.ear-name { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.ear-sub { font-size: 10.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ear-right { text-align: right; flex: 0 0 auto; }
.ear-batt { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ear-batt.low { color: var(--red); } .ear-batt.mid { color: #B45309; }
.ear-state { font-size: 10px; color: var(--muted); margin-top: 2px; }

.battery { height: 4px; width: 100%; border-radius: 2px; background: #EDF1F6; margin-top: 5px; overflow: hidden; }
.battery i { display: block; height: 100%; border-radius: 2px; background: var(--green); }
.battery.mid i { background: #E9A23B; } .battery.low i { background: var(--red); }
.battery.unknown i { width: 0; }

.filters { display: flex; gap: 7px; margin: 2px 0 10px; overflow-x: auto; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filter {
  height: 30px; padding: 0 12px; border-radius: 16px; background: #fff;
  color: #5A6A7D; font-size: 12px; border: 1px solid var(--line); white-space: nowrap;
}
.filter.on { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---------------- 网络 ---------------- */
.net-state { display: flex; align-items: center; gap: 12px; }
.net-icon { width: 46px; height: 46px; border-radius: 14px; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; flex: 0 0 auto; }
.net-icon.off { background: #F1F4F8; color: #7A8798; }
.net-icon.fail { background: #FDECEA; color: var(--red); }
.kv { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); flex: 0 0 auto; }
.kv .v { text-align: right; font-weight: 600; word-break: break-all; }

.talk-vol { display: flex; align-items: center; gap: 10px; padding: 10px 0 2px; }
.talk-vol input[type="range"] { flex: 1; min-width: 0; height: 26px; accent-color: var(--blue); }
.talk-vol .btn { flex: 0 0 auto; }
.task-row { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.task-row:last-child { border-bottom: 0; }
.task-dot { width: 8px; height: 8px; border-radius: 50%; background: #B7C0CC; flex: 0 0 auto; }
.task-dot.success { background: var(--green); } .task-dot.failed, .task-dot.timeout { background: var(--red); }
.task-dot.running { background: var(--blue); animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.task-main { flex: 1; min-width: 0; }
.task-title { font-size: 12.5px; font-weight: 600; }
.task-sub { font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.task-time { font-size: 10px; color: #9AA6B5; white-space: nowrap; }

/* ---------------- 设置 / 列表 ---------------- */
.group { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 12px; }
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 14px 15px;
  width: 100%; text-align: left; border-bottom: 1px solid var(--line); min-height: 52px;
}
.list-item:last-child { border-bottom: 0; }
.list-item:active { background: #FAFBFD; }
.li-icon { width: 30px; height: 30px; border-radius: 9px; background: #F1F4F8; color: #5A6A7D; display: grid; place-items: center; flex: 0 0 auto; }
.li-main { flex: 1; min-width: 0; }
.li-title { font-size: 13.5px; font-weight: 600; }
.li-sub { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.li-right { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.chev { color: #C2CBD7; font-size: 17px; line-height: 1; }
.device-badge { display: flex; align-items: center; gap: 12px; padding: 4px; }
.device-badge .db-ic { width: 46px; height: 46px; border-radius: 14px; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; }
.device-badge .db-name { font-size: 15px; font-weight: 700; }
.device-badge .db-sub { font-size: 10.5px; color: var(--muted); margin-top: 2px; }

.switch { width: 44px; height: 26px; border-radius: 13px; background: #DDE3EB; position: relative; transition: background .18s; flex: 0 0 auto; }
.switch:after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.18); transition: transform .18s; }
.switch.on { background: var(--green); }
.switch.on:after { transform: translateX(18px); }

/* ---------------- 表单 ---------------- */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 12px; font-weight: 600; color: #445166; margin-bottom: 6px; }
.input, select.input, textarea.input {
  width: 100%; height: 46px; border: 1px solid #DDE4ED; border-radius: 11px;
  padding: 0 12px; background: #FBFCFE; outline: none; font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(46,117,182,.12); background: #fff; }
.input::placeholder { color: #A9B4C2; }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 46px; }
.input-eye { position: absolute; right: 4px; top: 3px; width: 40px; height: 40px; color: #7A8798; display: grid; place-items: center; }
.hint { font-size: 10.5px; color: var(--muted); line-height: 1.55; margin-top: 6px; }
.err-text { font-size: 11px; color: var(--red); margin-top: 6px; line-height: 1.5; }
.form-error { background: #FFF2F1; border: 1px solid #F3D5D2; color: #B3261E; border-radius: 10px; padding: 9px 11px; font-size: 12px; margin-bottom: 12px; line-height: 1.5; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: #EEF2F7; border-radius: 11px; padding: 3px; gap: 3px; }
.seg button { height: 38px; border-radius: 9px; font-size: 12.5px; color: #5A6A7D; font-weight: 600; }
.seg button.on { background: #fff; color: var(--navy); box-shadow: 0 1px 4px rgba(16,24,40,.10); }

.code-input { letter-spacing: 2px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 16px; text-align: center; }
.code-group { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.code-group input {
  height: 50px; border: 1px solid #DDE4ED; border-radius: 10px; text-align: center;
  font-size: 18px; font-weight: 700; background: #FBFCFE; outline: none; letter-spacing: 1px;
  min-width: 0; text-transform: uppercase;
}
.code-group input:focus { border-color: var(--blue); background: #fff; }

/* ---------------- 配网向导 ---------------- */
.steps { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; }
.step-dot { flex: 1; height: 4px; border-radius: 2px; background: #E3E9F1; }
.step-dot.on { background: var(--blue); }
.step-dot.done { background: #9FC5E8; }
.scan-ring {
  width: 132px; height: 132px; margin: 18px auto 14px; border-radius: 50%;
  border: 2px solid #DCE8F5; display: grid; place-items: center; position: relative;
}
.scan-ring:before, .scan-ring:after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid transparent;
  border-top-color: var(--blue); animation: spin 1.4s linear infinite;
}
.scan-ring:after { inset: 12px; animation-duration: 1.9s; animation-direction: reverse; border-top-color: #9CC7EE; }
.scan-ring-core { width: 88px; height: 88px; border-radius: 50%; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; }
.ap-list { margin-top: 8px; }
.ap-row { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.ap-row:last-child { border-bottom: 0; }
.ap-row:active { background: #FAFBFD; }
.ap-ic { width: 34px; height: 34px; border-radius: 10px; background: #F1F4F8; color: #5A6A7D; display: grid; place-items: center; flex: 0 0 auto; }
.ap-main { flex: 1; min-width: 0; }
.ap-ssid { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-sub { font-size: 10px; color: var(--muted); margin-top: 1px; }
.ap-lock { color: #98A4B3; }

.progress { height: 7px; border-radius: 4px; background: #EAF0F6; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, #2E75B6, #5FA8E8); transition: width .35s ease; }
.stage-list { margin-top: 14px; }
.stage { display: flex; gap: 10px; align-items: center; padding: 7px 0; font-size: 12px; color: var(--muted); }
.stage .sc { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #D8E0EA; display: grid; place-items: center; font-size: 10px; flex: 0 0 auto; }
.stage.done .sc { background: var(--green); border-color: var(--green); color: #fff; }
.stage.active .sc { border-color: var(--blue); border-top-color: transparent; animation: spin .9s linear infinite; }
.stage.fail .sc { background: var(--red); border-color: var(--red); color: #fff; }
.stage.done, .stage.active { color: #2C3A4D; }

.result-icon { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; margin: 8px auto 14px; }
.result-icon.ok { background: #EAF5EA; color: var(--green); }
.result-icon.fail { background: #FDECEA; color: var(--red); }
.result-title { font-size: 19px; font-weight: 700; text-align: center; }
.result-sub { font-size: 12px; color: var(--muted); text-align: center; margin-top: 5px; line-height: 1.6; }
.result-facts { background: #F8FAFD; border-radius: 12px; padding: 4px 12px; margin-top: 16px; }

.notice { display: flex; gap: 9px; align-items: flex-start; background: #FFF8EC; border: 1px solid #FBE7C6; color: #8A5300; border-radius: 11px; padding: 10px 12px; font-size: 11.5px; line-height: 1.55; }
.notice.blue { background: #EFF6FD; border-color: #D4E6F7; color: #1C4E80; }
.notice.red { background: #FFF2F1; border-color: #F3D5D2; color: #9B1C1C; }
.notice svg { flex: 0 0 auto; margin-top: 1px; }

.local-step { display: flex; gap: 11px; padding: 10px 0; }
.local-no { width: 22px; height: 22px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; flex: 0 0 auto; }
.local-step .t { font-size: 12.5px; font-weight: 600; }
.local-step .d { font-size: 11px; color: var(--muted); margin-top: 2px; line-height: 1.55; }
.softap-box { background: #F3F7FC; border: 1px dashed #C7DBF0; border-radius: 12px; padding: 12px; text-align: center; margin: 12px 0; }
.softap-ssid { font-size: 17px; font-weight: 700; letter-spacing: .4px; color: var(--navy); }
.softap-sub { font-size: 10.5px; color: var(--muted); margin-top: 3px; }
.countdown { font-variant-numeric: tabular-nums; }

/* ---------------- 消息 ---------------- */
.msg-item { display: flex; gap: 11px; padding: 13px 2px; border-bottom: 1px solid var(--line); width: 100%; text-align: left; }
.msg-item:last-child { border-bottom: 0; }
.msg-item .mic { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; flex: 0 0 auto; background: #FFF3E3; color: #B45309; }
.msg-item.high .mic { background: #FDECEA; color: #B3261E; }
.msg-item.low .mic { background: #F1F4F8; color: #5A6A7D; }
.msg-item.unread .mt { font-weight: 700; }
.msg-main { flex: 1; min-width: 0; }
.mt { font-size: 12.5px; line-height: 1.4; }
.mm { font-size: 11px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.mtime { font-size: 9.5px; color: #A0ACBB; white-space: nowrap; margin-left: 6px; }
.unread-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--red); flex: 0 0 auto; margin-top: 6px; }

/* ---------------- 抽屉 / 弹窗 / Toast ---------------- */
.sheet-host, .modal-host { position: fixed; inset: 0; z-index: 40; display: flex; }
.sheet-host { align-items: flex-end; justify-content: center; background: rgba(12, 20, 33, .38); }
.sheet-host.hidden, .modal-host.hidden { display: none !important; }
.sheet {
  width: 100%; max-width: 520px; background: #fff; border-radius: 20px 20px 0 0;
  padding: 8px 16px calc(18px + var(--safe-b)); max-height: 86vh; overflow-y: auto;
  animation: sheetUp .22s ease; box-shadow: 0 -10px 40px rgba(10, 20, 35, .18);
}
@keyframes sheetUp { from { transform: translateY(30px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
.sheet-grip { width: 38px; height: 4px; border-radius: 2px; background: #DCE3EB; margin: 4px auto 12px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sheet-title { font-size: 16px; font-weight: 700; }
.sheet-close { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #7A8798; background: #F3F6FA; }
.modal-host { align-items: center; justify-content: center; background: rgba(12,20,33,.45); padding: 22px; }
.modal {
  width: 100%; max-width: 360px; background: #fff; border-radius: 18px; padding: 20px 18px 16px;
  box-shadow: 0 22px 60px rgba(10,20,35,.28); animation: modalIn .18s ease;
}
@keyframes modalIn { from { transform: scale(.95); opacity: .5; } to { transform: scale(1); opacity: 1; } }
.modal-title { font-size: 16px; font-weight: 700; text-align: center; }
.modal-text { font-size: 12.5px; color: var(--muted); text-align: center; line-height: 1.65; margin-top: 8px; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 18px; }
.modal-actions.single { grid-template-columns: 1fr; }
.toast {
  position: fixed; left: 50%; top: calc(72px + env(safe-area-inset-top, 0px)); transform: translate(-50%, -8px);
  background: rgba(24, 33, 46, .92); color: #fff; font-size: 12.5px; line-height: 1.5;
  padding: 10px 16px; border-radius: 11px; max-width: min(86vw, 420px); text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; z-index: 60;
  backdrop-filter: blur(6px); white-space: pre-wrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: rgba(150, 32, 26, .95); }

/* ---------------- 状态 / 空态 / 骨架 ---------------- */
.empty { padding: 34px 16px; text-align: center; color: var(--muted); }
.empty .ei { width: 56px; height: 56px; border-radius: 18px; background: #F0F4F9; color: #9BA9BA; display: grid; place-items: center; margin: 0 auto 12px; }
.empty .et { font-size: 13.5px; color: #5A6A7D; font-weight: 600; }
.empty .ed { font-size: 11.5px; margin-top: 5px; line-height: 1.6; }
.skeleton { background: linear-gradient(90deg, #EEF2F7 25%, #F7F9FC 37%, #EEF2F7 63%); background-size: 400% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.sk-line { height: 12px; margin: 8px 0; }
.sk-card { height: 110px; border-radius: 14px; margin-bottom: 12px; }
.center-note { text-align: center; font-size: 11px; color: #9AA6B5; line-height: 1.7; padding: 10px 6px; }
.footer-note { text-align: center; font-size: 10.5px; color: #A3AEBC; margin: 18px 0 6px; line-height: 1.7; }

/* ---------------- 暗色模式 ---------------- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F141B; --card: #161D27; --text: #E8EEF6; --muted: #93A1B4; --line: #26303D;
    --blue-soft: #172C42; --shadow: 0 2px 10px rgba(0,0,0,.35);
  }
  body { background: #080B10; }
  .calc-view { background: #101318; color: #fff; }
  .calc-menu i { background: #A4AEBD; }
  .calc-keys { background: #171B22; box-shadow: none; }
  .calc-expr { color: #7C8797; }
  .ck { background: #242932; color: #fff; box-shadow: none; }
  .ck.fn { color: #E1E5EA; }
  .ck.op { color: #69A9FF; }
  .ck.pressed { background: #343C48; }
  .ck::after { background: rgba(140, 160, 188, .18); }
  .ck.eq { background: #0B5EDB; color: #fff; }
  .ck.eq.pressed { background: #084FB9; }
  .app-top { background: rgba(18, 24, 33, .97); }
  .tabbar { background: rgba(18, 24, 33, .98); }
  .icon-btn { color: #AEBBCC; }
  .badge { border-color: #161D27; }
  .card, .group, .summary-cell { background: var(--card); }
  .slot-chip { background: #121923; border-color: #26303D; }
  .slot-chip.online { background: #12251A; border-color: #234A2B; }
  .slot-chip.suspect { background: #2A2114; border-color: #4A3A1E; }
  .slot-chip.unauthorized { background: #2A1616; border-color: #4A2626; }
  .ear-avatar { background: #1B2430; color: #A9B6C7; }
  .ear-avatar.online { background: #172A1B; color: #7BC47F; }
  .ear-avatar.unauthorized { background: #2A1616; color: #F1998F; }
  .input { background: #121923; border-color: #2A3544; color: var(--text); }
  .input:focus { background: #0F1620; }
  .code-group input { background: #121923; border-color: #2A3544; color: var(--text); }
  .seg { background: #101720; }
  .seg button.on { background: #1B2430; color: #CFE0F3; }
  .sheet, .modal { background: #161D27; }
  .sheet-close { background: #222C39; color: #A9B6C7; }
  .btn { background: #222C39; color: #D6E1EE; }
  .btn.ghost { background: #161D27; border-color: #2A3544; color: #D6E1EE; }
  .btn.danger { background: #2A1616; border-color: #4A2626; color: #F1998F; }
  .filter { background: #161D27; border-color: #2A3544; color: #A9B6C7; }
  .filter.on { background: #2E75B6; border-color: #2E75B6; color: #fff; }
  .result-facts, .softap-box { background: #121923; border-color: #2A3544; }
  .notice { background: #2A2114; border-color: #4A3A1E; color: #E9C48A; }
  .notice.blue { background: #12202E; border-color: #24405A; color: #9FC7EC; }
  .notice.red { background: #2A1616; border-color: #4A2626; color: #F1998F; }
  .banner.warn { background: #2A2114; border-color: #4A3A1E; color: #E9C48A; }
  .banner.info { background: #12202E; border-color: #24405A; color: #9FC7EC; }
  .banner.danger { background: #2A1616; border-color: #4A2626; color: #F1998F; }
  .task-row, .kv, .ear-row, .msg-item, .list-item, .ap-row { border-color: #26303D; }
  .skeleton { background: linear-gradient(90deg, #1A222D 25%, #222C39 37%, #1A222D 63%); background-size: 400% 100%; }
}

/* ---------------- 打印/截图降级 ---------------- */
@media print {
  body { display: none !important; }
}

/* ---------------- 宽屏（桌面演示） ---------------- */
@media (min-width: 560px) {
  body { background: #DCE3EC; }
  .calc-view, .app-view {
    box-shadow: 0 20px 60px rgba(18, 32, 54, .18);
    border-left: 1px solid rgba(0,0,0,.04);
    border-right: 1px solid rgba(0,0,0,.04);
  }
}
