/* ==========================================================================
   符米 4G 智能手表 FM01 (deviceType=591943) · 移动爱家健康管控页样式表
   严格对齐《爱家健康手环手表管控页面对接规范（2026-03-18更新）》官方视觉规范
   ========================================================================== */

:root {
    --primary: #3084F2;
    --primary-light: #53ABFE;
    --primary-soft: #ebf3ff;
    --success: #00c27a;
    --warning: #FAA700;
    --danger: #FA4B4B;
    --purple: #6366f1;
    --teal: #15c39a;
    --bg-page: #F2F5F5;
    --bg-card: #ffffff;
    --text-main: rgba(0, 0, 0, 0.8);
    --text-sub: rgba(0, 0, 0, 0.5);
    --text-muted: rgba(0, 0, 0, 0.38);
    --border-hairline: rgba(0, 0, 0, 0.08);
    --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.04);
    --radius-card: 14px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    background-color: #e8ecf4;
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    line-height: 1.45;
    min-height: 100vh;
    overflow-x: hidden;
}

/* 手机视口容器：电脑浏览器居中展示手机壳质感，手机端自适应 100% 满屏 */
.app-shell {
    max-width: 430px;
    min-height: 100vh;
    margin: 0 auto;
    background: linear-gradient(180deg, #d6e8ff 0%, #e8f1ff 230px, var(--bg-page) 340px, var(--bg-page) 100%);
    position: relative;
    padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 0 40px rgba(15, 23, 42, 0.08);
}

/* ==========================================================================
   顶部透明导航栏
   ========================================================================== */
.navbar {
    position: sticky;
    top: 0;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px 8px;
    background: rgba(216, 233, 255, 0.85);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-back {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
    cursor: pointer;
}

.navbar-title {
    font-size: 17px;
    font-weight: 500;
    color: var(--text-main);
    letter-spacing: 0.2px;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-gear-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.65);
    color: var(--text-main);
    cursor: pointer;
}

/* ==========================================================================
   Tab 容器与通用区块标题
   ========================================================================== */
.tab-pane {
    display: none;
    padding: 12px 14px 0;
    animation: fadeIn 0.2s ease;
}

.tab-pane.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 16px 2px 10px;
}

.section-bar-left {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
}

.section-bar-left::before {
    content: "";
    display: inline-block;
    width: 3.5px;
    height: 15px;
    border-radius: 2px;
    background: linear-gradient(180deg, #53ABFE 0%, #3084F2 100%);
}

.section-bar-more {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 2px;
    cursor: pointer;
}

/* ==========================================================================
   1. 顶部智能手表 Hero 区（完全对齐规范图2：左文字+电量+刷新胶囊，右3D手表）
   ========================================================================== */
.hero-banner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 6px 14px 6px;
    min-height: 176px;
}

/* 顶部悬浮同步状态胶囊 (数据同步中... / 数据同步完成) */
.sync-float-pill {
    position: absolute;
    top: -2px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 5px 14px;
    border-radius: 999px;
    box-shadow: 0 4px 14px rgba(37, 117, 252, 0.12);
    font-size: 12px;
    color: var(--text-sub);
    display: none;
    align-items: center;
    gap: 6px;
    z-index: 20;
    white-space: nowrap;
}

.sync-float-pill.show {
    display: inline-flex;
}

.hero-info {
    flex: 1;
    padding-right: 8px;
}

.hero-device-title {
    font-size: 21px;
    font-weight: 700;
    color: #1d2129;
    line-height: 1.28;
    margin-bottom: 10px;
    letter-spacing: 0.2px;
}

.hero-status-line {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--text-sub);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
    color: #4e5969;
}

.status-pill .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(0, 194, 122, 0.18);
}

.status-pill.offline .dot {
    background: #c9cdd4;
    box-shadow: none;
}

/* 拟真电池图标 + 百分比 */
.battery-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #4e5969;
    font-size: 13px;
    font-weight: 500;
}

.battery-icon-box {
    position: relative;
    width: 24px;
    height: 12px;
    border: 1.5px solid #23c383;
    border-radius: 3px;
    padding: 1.5px;
    display: inline-flex;
    align-items: center;
}

.battery-icon-box::after {
    content: "";
    position: absolute;
    right: -3.5px;
    top: 2.5px;
    width: 2px;
    height: 4px;
    border-radius: 0 1px 1px 0;
    background: #23c383;
}

.battery-bar-fill {
    height: 100%;
    width: 86%;
    background: linear-gradient(90deg, #16c98d 0%, #2ce09b 100%);
    border-radius: 1px;
    transition: width 0.3s ease;
}

.battery-pill.low .battery-icon-box {
    border-color: var(--danger);
}
.battery-pill.low .battery-icon-box::after,
.battery-pill.low .battery-bar-fill {
    background: var(--danger);
}

/* 蓝色渐变发光刷新胶囊按钮（V3.0 按钮规范：#53ABFE -> #3084F2 左右 45° 渐变） */
.sync-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 22px;
    border-radius: 999px;
    border: none;
    background: linear-gradient(135deg, #53ABFE 0%, #3084F2 100%);
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(48, 132, 242, 0.28);
    transition: transform 0.15s, box-shadow 0.15s;
}

.sync-btn:active {
    transform: scale(0.96);
    box-shadow: 0 3px 8px rgba(37, 117, 252, 0.25);
}

.sync-btn:disabled {
    opacity: 0.78;
}

.sync-btn svg {
    width: 15px;
    height: 15px;
}

.sync-btn.spinning svg {
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.hero-watch-wrap {
    width: 142px;
    height: 168px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    filter: drop-shadow(0 12px 20px rgba(25, 59, 108, 0.18));
}

.hero-watch-img {
    width: 138px;
    height: auto;
    object-fit: contain;
}

/* ==========================================================================
   通用白底圆角卡片
   ========================================================================== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    padding: 16px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-card);
    transition: transform 0.15s ease;
}

.card-clickable {
    cursor: pointer;
}

.card-clickable:active {
    transform: scale(0.99);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-more {
    font-size: 12px;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 2px;
    cursor: pointer;
}

/* ==========================================================================
   2. 运动健康数据卡片（对齐规范图2：三列图标+大号数字+目标分母）
   ========================================================================== */
.sport-metrics-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding-top: 2px;
}

.sport-metric-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.sport-metric-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-sub);
    margin-bottom: 6px;
}

.sport-metric-label svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.sport-metric-val {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
}

.sport-metric-goal {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ==========================================================================
   3. 最新运动数据卡片（左蓝色跑步圆标，中公里/千卡/时间，右轨迹缩略图）
   ========================================================================== */
.latest-sport-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.sport-Runner-badge {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4facfe 0%, #298dff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(41, 141, 255, 0.26);
}

.sport-record-center {
    flex: 1;
    min-width: 0;
}

.sport-record-mainline {
    display: flex;
    align-items: baseline;
    flex-wrap: nowrap;
    white-space: nowrap;
    gap: 3px;
    color: var(--text-main);
}

.sport-record-type {
    font-size: 15px;
    font-weight: 700;
    margin-right: 2px;
}

.sport-record-num {
    font-size: 19px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.sport-record-unit {
    font-size: 11px;
    color: var(--text-muted);
    margin-right: 6px;
}

.sport-record-subline {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 3px;
}

.sport-mini-map {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    background: #eef6ff;
    border: 1px solid #dcebff;
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================================================
   4. 昨日睡眠卡片（左蓝紫圆环评分 + 右入睡/时长/醒来三列 + 深浅睡比例条）
   ========================================================================== */
.sleep-overview-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.sleep-ring-box {
    position: relative;
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sleep-ring-text {
    position: absolute;
    display: flex;
    align-items: baseline;
    justify-content: center;
    font-weight: 700;
    color: var(--text-main);
}

.sleep-ring-text .num {
    font-size: 19px;
}

.sleep-ring-text .unit {
    font-size: 10px;
    color: var(--text-sub);
    margin-left: 1px;
}

.sleep-cols {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.sleep-col-lbl {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 4px;
}

.sleep-col-lbl .dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #597ef7;
}

.sleep-col-val {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
}

.sleep-col-val small {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-sub);
}

.sleep-bar-stack {
    height: 6px;
    border-radius: 999px;
    background: #f2f3f5;
    overflow: hidden;
    display: flex;
    margin-top: 12px;
}

.sleep-seg-deep {
    background: linear-gradient(90deg, #597ef7, #722ed1);
    height: 100%;
}

.sleep-seg-light {
    background: #adc6ff;
    height: 100%;
}

/* ==========================================================================
   5. 心率与血氧卡片（对齐规范图2：彩色圆标+大字数值+趋势图+时间戳）
   ========================================================================== */
.vital-badge-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.vital-badge-icon.hr {
    background: linear-gradient(135deg, #ff7875 0%, #ff4d4f 100%);
    box-shadow: 0 3px 8px rgba(255, 77, 79, 0.25);
}

.vital-badge-icon.spo2 {
    background: linear-gradient(135deg, #36cfc9 0%, #13c2c2 100%);
    box-shadow: 0 3px 8px rgba(19, 194, 194, 0.25);
}

.vital-badge-icon.stress {
    background: linear-gradient(135deg, #b37feb 0%, #9254de 100%);
    box-shadow: 0 3px 8px rgba(146, 84, 222, 0.25);
}

.vital-header-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 6px;
}

.vital-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
}

.vital-unit {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: 3px;
}

.vital-eval {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 600;
    background: #f2f3f5;
    color: var(--text-sub);
}

.vital-eval.normal {
    background: #e6fffb;
    color: #00a870;
}

.vital-eval.warn {
    background: #fff7e6;
    color: #fa8c16;
}

.vital-eval.danger {
    background: #fff1f0;
    color: #f5222d;
}

.svg-chart-box {
    width: 100%;
    height: 96px;
    margin-top: 4px;
}

/* ==========================================================================
   6. AI 健康分析卡片（浅蓝渐变内胆）
   ========================================================================== */
.ai-analysis-box {
    background: linear-gradient(135deg, #ebf3ff 0%, #f5f9ff 100%);
    border-radius: 12px;
    padding: 13px 14px;
    color: #2c3e5d;
    font-size: 13px;
    line-height: 1.62;
    position: relative;
    border: 1px solid rgba(37, 117, 252, 0.08);
}

/* ==========================================================================
   7. 健康管理服务区（对齐规范图2：上三宫格 + 中双彩底横幅 + 下运动健康课程）
   ========================================================================== */
.service-top-trio {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

.trio-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 14px 8px 12px;
    text-align: center;
    box-shadow: var(--shadow-card);
    cursor: pointer;
    transition: transform 0.15s;
}

.trio-card:active {
    transform: scale(0.97);
}

.trio-icon-circle {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    margin: 0 auto 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.trio-icon-circle.orange {
    background: linear-gradient(135deg, #ffbb70 0%, #ff8b3d 100%);
    box-shadow: 0 6px 14px rgba(255, 139, 61, 0.28);
}

.trio-icon-circle.blue {
    background: linear-gradient(135deg, #74a8ff 0%, #447df7 100%);
    box-shadow: 0 6px 14px rgba(68, 125, 247, 0.28);
}

.trio-icon-circle.green {
    background: linear-gradient(135deg, #5ce0b8 0%, #20bf96 100%);
    box-shadow: 0 6px 14px rgba(32, 191, 150, 0.28);
}

.trio-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
}

.trio-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* 用药助手 & 监测提醒 双彩底卡片 */
.service-banner-pair {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.pastel-banner {
    border-radius: 14px;
    padding: 14px 12px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    min-height: 98px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.pastel-banner.sky {
    background: linear-gradient(135deg, #e3f1ff 0%, #f2f8ff 100%);
}

.pastel-banner.mint {
    background: linear-gradient(135deg, #e8f9e0 0%, #f4fdef 100%);
}

.pastel-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
}

.pastel-sub {
    font-size: 11px;
    color: var(--text-sub);
    margin-top: 2px;
}

.pastel-pill-btn {
    display: inline-block;
    margin-top: 10px;
    padding: 3px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    width: fit-content;
}

.pastel-banner.sky .pastel-pill-btn {
    background: linear-gradient(90deg, #4facfe, #2575fc);
}

.pastel-banner.mint .pastel-pill-btn {
    background: linear-gradient(90deg, #52c41a, #389e0d);
}

.pastel-deco-svg {
    position: absolute;
    right: 6px;
    bottom: 6px;
    width: 44px;
    height: 44px;
    opacity: 0.92;
}

/* 运动健康课程区 */
.course-pills {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 10px;
    scrollbar-width: none;
}
.course-pills::-webkit-scrollbar { display: none; }

.course-pill {
    padding: 5px 13px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    background: #ffffff;
    color: var(--text-sub);
    white-space: nowrap;
    cursor: pointer;
}

.course-pill.active {
    background: var(--primary);
    color: #ffffff;
    font-weight: 600;
}

.course-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 12px;
}

.course-card {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-card);
    cursor: pointer;
}

.course-thumb {
    height: 92px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.course-thumb.c1 {
    background: linear-gradient(135deg, #c2e9fb 0%, #a1c4fd 100%);
}

.course-thumb.c2 {
    background: linear-gradient(135deg, #d4fc79 0%, #96e6a1 100%);
}

.play-circle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(29, 33, 41, 0.45);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.course-body {
    padding: 8px 10px 10px;
}

.course-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.course-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ==========================================================================
   Tab 2: AI 健康管家（对齐规范图3：3D数字人助手 + 三大AI卡片 + 快捷提问）
   ========================================================================== */
.ai-hero-box {
    text-align: center;
    padding: 16px 0 8px;
}

.ai-doctor-avatar-lg {
    width: 92px;
    height: 92px;
    border-radius: 50%;
    margin: 0 auto 10px;
    box-shadow: 0 8px 24px rgba(37, 117, 252, 0.22);
    border: 3px solid #ffffff;
    display: block;
}

.ai-greet-card {
    background: linear-gradient(180deg, rgba(255,255,255,0.95) 0%, #ffffff 100%);
    border-radius: 18px;
    padding: 18px 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-card);
    text-align: left;
}

.ai-greet-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
    text-align: center;
}

.ai-greet-desc {
    font-size: 13px;
    color: var(--text-sub);
    line-height: 1.6;
}

.ai-feature-trio {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}

.ai-feat-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 12px 10px;
    box-shadow: var(--shadow-card);
    cursor: pointer;
}

.ai-feat-card.purple {
    background: linear-gradient(180deg, #ffffff 0%, #f5f0ff 100%);
}

.ai-feat-card.blue {
    background: linear-gradient(180deg, #ffffff 0%, #eef6ff 100%);
}

.ai-feat-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
}

.ai-feat-sub {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.35;
}

.ai-question-chip {
    background: #ffffff;
    border-radius: 999px;
    padding: 10px 16px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
    box-shadow: var(--shadow-card);
    cursor: pointer;
}

.ai-question-tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid #91caff;
    color: var(--primary);
    background: #f0f7ff;
}

/* ==========================================================================
   Tab 3: 定位与电子围栏（对齐规范图11：大地图卡片 + 围栏/SOS双彩块）
   ========================================================================== */
.map-showcase-card {
    position: relative;
    border-radius: var(--radius-card);
    overflow: hidden;
    height: 310px;
    margin-top: 6px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-card);
    background: #e6f0ea;
}

.map-top-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 14px 16px 26px;
    background: linear-gradient(180deg, rgba(20, 26, 36, 0.72) 0%, rgba(20, 26, 36, 0.35) 68%, transparent 100%);
    color: #ffffff;
    z-index: 5;
}

.map-overlay-row1 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.map-overlay-title {
    font-size: 15px;
    font-weight: 700;
}

.map-overlay-time {
    font-size: 11px;
    padding: 1px 7px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    color: rgba(255, 255, 255, 0.92);
}

.map-overlay-addr {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    gap: 5px;
}

.map-float-refresh {
    position: absolute;
    right: 14px;
    bottom: 14px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.14);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
    cursor: pointer;
    z-index: 5;
}

.loc-action-pair {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.loc-action-card {
    border-radius: 14px;
    padding: 16px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
    cursor: pointer;
}

.loc-action-card.mint {
    background: linear-gradient(135deg, #d8f7f0 0%, #eafcf8 100%);
}

.loc-action-card.lavender {
    background: linear-gradient(135deg, #dce7ff 0%, #eef3ff 100%);
}

.loc-action-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ==========================================================================
   Tab 4: 设备设置与参数下发（对齐规范图7 & 图8）
   ========================================================================== */
.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-hairline);
}

.setting-row:last-child {
    border-bottom: none;
}

.setting-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}

.setting-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* iOS 风格青色开关按钮 (对齐规范图8) */
.ios-switch {
    position: relative;
    width: 46px;
    height: 26px;
    display: inline-block;
    flex-shrink: 0;
}

.ios-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.ios-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #cbd5e1;
    border-radius: 26px;
    transition: 0.25s;
}

.ios-slider::before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 2px;
    bottom: 2px;
    background-color: #ffffff;
    border-radius: 50%;
    transition: 0.25s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.ios-switch input:checked + .ios-slider {
    background-color: #0eb893;
}

.ios-switch input:checked + .ios-slider::before {
    transform: translateX(20px);
}

.input-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    width: 100%;
}

.input-ctrl {
    flex: 1 1 0%;
    min-width: 0;
    padding: 9px 11px;
    border-radius: 10px;
    border: 1px solid #dcdfe6;
    font-size: 13px;
    color: var(--text-main);
    background: #f8fafc;
    outline: none;
}

.input-ctrl:focus {
    border-color: var(--primary);
    background: #ffffff;
}

.btn-primary {
    flex-shrink: 0;
    padding: 9px 15px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #53ABFE 0%, #3084F2 100%);
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 4px 10px rgba(48, 132, 242, 0.24);
}

.btn-primary:active {
    transform: scale(0.98);
}

.contact-list {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.contact-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    border-radius: 10px;
    background: #f7f9fc;
    font-size: 13px;
}

.del-contact-btn {
    border: none;
    background: #fff1f0;
    color: var(--danger);
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
}

.empty-placeholder {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    padding: 18px 0;
}

/* ==========================================================================
   底部悬浮导航栏 TabBar（对齐规范图2 & 图5：磨砂白底 + 中间凸起AI健康管家头像）
   ========================================================================== */
.tabbar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 430px;
    height: calc(64px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(232, 238, 242, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    align-items: center;
    z-index: 100;
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.05);
}

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: #4E5E79;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    height: 100%;
}

.tab-item svg {
    width: 24px;
    height: 24px;
    transition: transform 0.15s;
}

.tab-item.active {
    color: var(--primary);
    font-weight: 600;
}

.tab-item.active svg {
    transform: translateY(-1px);
}

.tab-ai-avatar-wrap {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    margin-top: -12px;
    background: linear-gradient(180deg, #d9ecff 0%, #ffffff 100%);
    padding: 2px;
    box-shadow: 0 4px 10px rgba(37, 117, 252, 0.22);
    overflow: hidden;
}

.tab-ai-avatar-wrap img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* ==========================================================================
   Toast
   ========================================================================== */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(8px);
    color: #ffffff;
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 13px;
    max-width: 340px;
    text-align: center;
    z-index: 300;
    display: none;
    white-space: pre-line;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
}

/* ==========================================================================
   2026-11-19 合并：连接状态、同步提示、两列健康卡片、定位入口、设备菜单与子页面
   ========================================================================== */
button { font-family: inherit; border: 0; }

.app-shell.plain-bg { background: var(--bg-page); }
.app-shell.plain-bg .navbar { background: rgba(242, 245, 245, 0.92); }
.app-shell.in-sub-page { padding-bottom: 24px; }

.link-btn {
    padding: 0;
    background: transparent;
    color: var(--primary);
    font-size: inherit;
    cursor: pointer;
}

.conn-status { color: var(--text-sub); font-size: 14px; white-space: nowrap; }
/* 规范：电量小于 20% 时电池为黄色 */
.battery-pill.low .battery-icon-box { border-color: #f5a623; }
.battery-pill.low .battery-icon-box::after,
.battery-pill.low .battery-bar-fill { background: #f5a623; }
/* “连接失败点击重新连接”较长，放不下时电量换到下一行，文字本身不折行 */
.hero-status-line { flex-wrap: wrap; row-gap: 6px; }
.sync-btn { cursor: pointer; }
.spin, .spinning svg { animation: spin 0.9s linear infinite; }

/* 同步提示：页面顶部居中的白色胶囊 */
.sync-toast {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 95;
    display: none;
    align-items: center;
    gap: 7px;
    height: 28px;
    padding: 0 10px 0 6px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 4px 14px rgba(37, 117, 252, 0.12);
    color: rgba(0, 0, 0, 0.8);
    font-size: 12px;
    white-space: nowrap;
}
.sync-toast.show { display: inline-flex; }
.sync-toast svg { flex: none; }

/* 健康数据卡片：两列 */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}
.metric-grid.single { grid-template-columns: 1fr; }
/* 卡片数是单数时，最后一张占满一行 */
.metric-grid > .metric-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
.metric-card { margin-bottom: 0; padding: 12px; min-width: 0; }
.metric-card .card-header { margin-bottom: 6px; }
.metric-card .card-title { font-size: 14px; gap: 5px; white-space: nowrap; }
.metric-card .vital-eval { padding: 1px 6px; }
.metric-value-row { display: flex; align-items: baseline; white-space: nowrap; }
.metric-chart { height: 54px; margin-top: 2px; }
.metric-chart .empty-placeholder { padding: 18px 0 0; }
.metric-time { min-height: 15px; margin-top: 2px; color: var(--text-muted); font-size: 10px; }

/* AI 健康管家入口页 */
.ai-entry { display: flex; flex-direction: column; align-items: center; padding: 56px 16px 0; text-align: center; }
.ai-entry-title { margin-top: 16px; font-size: 18px; font-weight: 600; color: var(--text-main); }
.ai-entry-desc { margin-top: 8px; font-size: 14px; color: var(--text-muted); }
.ai-entry-btn { width: 220px; margin-top: 28px; padding: 12px 0; border-radius: 999px; font-size: 15px; }

/* 定位：示意底图（接入地图服务后替换 .map-panel 里的内容） */
.map-panel {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    overflow: hidden;
    background-color: #e8eef2;
    background-image: linear-gradient(rgba(255, 255, 255, 0.6) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.6) 1px, transparent 1px);
    background-size: 40px 40px;
}
.map-road { position: absolute; width: 150%; height: 6px; border-radius: 6px; background: #fff; opacity: 0.9; }
.map-road.r1 { top: 37%; left: -22%; transform: rotate(-29deg); }
.map-road.r2 { top: 72%; left: -20%; transform: rotate(-17deg); }
.map-road.r3 { top: 49%; left: -30%; transform: rotate(72deg); }
.map-pin { position: absolute; top: 50%; left: 50%; display: flex; align-items: center; flex-direction: column; transform: translate(-50%, -50%); }
.map-pin-head { position: relative; display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 50%; background: #14c9a0; }
.map-pin-head::after { position: absolute; bottom: -8px; left: 16px; width: 16px; height: 16px; background: #14c9a0; content: ""; transform: rotate(45deg); }
.map-pin-head span { position: relative; z-index: 1; width: 18px; height: 18px; border-radius: 50%; background: #fff; }
.map-pin i { width: 10px; height: 10px; margin-top: 16px; border: 2px solid #fff; border-radius: 50%; background: #14c9a0; box-sizing: content-box; }
.map-showcase-card { height: 380px; background: #e8eef2; }
.map-overlay-addr span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.map-float-refresh { border: 0; }

.loc-entry-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.loc-entry {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 70px;
    padding: 0 14px;
    border-radius: 14px;
    color: rgba(0, 0, 0, 0.8);
    font-size: 15px;
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
}
.loc-entry.fence { background: linear-gradient(135deg, #d4f4ec, #ecfaf6); }
.loc-entry.fence .loc-action-icon { color: #14c9a0; }
.loc-entry.track { background: linear-gradient(135deg, #dfe4ff, #eef1ff); }
.loc-entry.track .loc-action-icon { color: #5c70ff; }
.loc-entry.contacts { grid-column: 1 / -1; background: linear-gradient(135deg, #ffe4e1, #fff3f1); }
.loc-entry.contacts .loc-action-icon { color: #ff4841; }
/* 历史轨迹关掉时，地理围栏独占一行 */
.loc-entry-grid.no-track .loc-entry.fence { grid-column: 1 / -1; }
.loc-entry-value { margin-left: auto; color: rgba(0, 0, 0, 0.5); font-size: 14px; font-weight: 400; }

/* 设备页菜单 */
.menu-list { display: grid; gap: 10px; margin-top: 8px; }
.menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 48px;
    padding: 0 12px;
    border-radius: 14px;
    background: #fff;
    color: rgba(0, 0, 0, 0.8);
    font-size: 16px;
    text-align: left;
    cursor: pointer;
}
.menu-item svg { color: rgba(0, 0, 0, 0.35); }
.chev-down { display: inline-flex; transform: rotate(90deg); }

/* 子页面 */
.sub-page { display: none; min-height: 100vh; background: var(--bg-page); }
.sub-page.active { display: block; }
.sub-nav { position: sticky; top: 0; z-index: 90; display: flex; align-items: center; height: 44px; padding: 0 12px; background: var(--bg-page); }
.sub-nav-back { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; background: transparent; color: var(--text-main); cursor: pointer; }
.sub-nav h1 { position: absolute; right: 52px; left: 52px; overflow: hidden; color: rgba(0, 0, 0, 0.8); font-size: 17px; font-weight: 400; line-height: 24px; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.sub-body { padding: 12px 16px 24px; }
.sub-h2 { margin: 0 0 6px; color: rgba(0, 0, 0, 0.8); font-size: 15px; font-weight: 600; line-height: 21px; }
.sub-note { margin-top: 8px; color: rgba(0, 0, 0, 0.5); font-size: 12px; line-height: 17px; }
.state-text { padding: 56px 16px; color: rgba(0, 0, 0, 0.5); font-size: 14px; text-align: center; }

/* 设备信息 */
.info-watch { display: block; width: 110px; height: 110px; margin: 16px auto 24px; object-fit: contain; }
.info-card { margin: 0 10px; padding-left: 16px; border-radius: 14px; background: #fff; }
.info-row { display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding-right: 16px; border-bottom: 1px solid rgba(0, 0, 0, 0.08); color: rgba(0, 0, 0, 0.8); font-size: 16px; }
.info-row:last-child { border-bottom: 0; }
.info-row span:first-child { flex: none; }
.info-value { overflow: hidden; margin-left: 12px; color: rgba(0, 0, 0, 0.5); font-size: 14px; text-align: right; text-overflow: ellipsis; white-space: nowrap; }

/* 数据自动检测 */
.switch-card { padding: 0 12px; border-radius: 14px; background: #fff; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid rgba(0, 0, 0, 0.08); }
.switch-row:last-child { border-bottom: 0; }
.sheet-overlay { position: fixed; z-index: 200; top: 0; right: 0; bottom: 0; left: 0; display: flex; align-items: flex-end; justify-content: center; background: rgba(0, 0, 0, 0.5); }
.sheet { width: 100%; max-width: 430px; padding-bottom: env(safe-area-inset-bottom, 0px); border-radius: 14px 14px 0 0; background: #fff; }
.sheet-head { display: grid; grid-template-columns: 64px 1fr 64px; align-items: center; height: 52px; padding: 0 8px; text-align: center; font-size: 16px; }
.sheet-cancel { background: transparent; color: rgba(0, 0, 0, 0.5); font-size: 15px; cursor: pointer; }
.sheet-option { display: block; width: 100%; height: 48px; border-top: 1px solid rgba(0, 0, 0, 0.06); background: transparent; color: rgba(0, 0, 0, 0.8); font-size: 16px; cursor: pointer; }
.sheet-option.active { color: var(--primary); font-weight: 600; }

/* 健康资讯 */
.news-list { display: grid; gap: 10px; margin-bottom: 12px; }
.news-item { display: flex; gap: 12px; padding: 12px; border-radius: 14px; background: #fff; cursor: pointer; }
.news-text { flex: 1; min-width: 0; }
.news-title { overflow: hidden; font-size: 15px; font-weight: 600; color: var(--text-main); text-overflow: ellipsis; white-space: nowrap; }
.news-summary { display: -webkit-box; overflow: hidden; margin-top: 4px; color: var(--text-sub); font-size: 12px; line-height: 18px; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.news-meta { display: flex; justify-content: space-between; margin-top: 6px; color: var(--text-muted); font-size: 10px; }
.news-cover { width: 96px; height: 64px; border-radius: 8px; object-fit: cover; flex: none; }

/* 使用说明 */
.manual-section h2 { margin-bottom: 8px; font-size: 15px; }
.manual-section p { margin-top: 6px; color: var(--text-sub); font-size: 14px; line-height: 22px; }

/* 设备页底部版本号 */
.app-version { margin: 24px 0 12px; color: rgba(0, 0, 0, 0.3); font-size: 12px; text-align: center; }

/* 不在移动爱家里打开时的提示页 */
.blocked-page { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 32px; background: #f5f6f8; }
.blocked-img { width: 120px; height: 120px; object-fit: contain; opacity: 0.85; }
.blocked-text { margin-top: 20px; color: rgba(0, 0, 0, 0.6); font-size: 15px; line-height: 22px; text-align: center; }
