/* ============================================================
 * 外勤管家 · 基础样式
 * 由原型 docs/外勤.html 抽取后做 App 化调整：
 *   1) 字号整体上调（正文 15px，辅助 12–13px）
 *   2) 圆角、阴影、间距放大，贴近原生 App 质感
 *   3) 修正 .subpage 高度，使 tab-bar 常驻底部
 * ============================================================ */

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #1a73e8; --primary-dark: #1558b0; --primary-light: #e8f0fe;
  --success: #0d904f; --success-light: #e6f4ea;
  --warning: #e37400; --warning-light: #fef7e0;
  --danger: #d93026; --danger-light: #fce8e6;
  --purple: #7b1fa2; --purple-light: #f4e9fb;
  --bg: #f4f6f9; --bg-card: #ffffff;
  --text: #1f2329; --text-secondary: #565c66; --text-hint: #9aa0a6;
  --border: #e4e7ed; --border-light: #eff1f5;
  --shadow: 0 2px 10px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .04);
  --shadow-lg: 0 10px 28px rgba(16, 24, 40, .12);
  --radius: 12px; --radius-sm: 9px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
  --topbar-h: 54px;
  --tabbar-h: 58px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}
html, body {
  height: 100%; overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg); color: var(--text);
  -webkit-tap-highlight-color: transparent; user-select: none;
  -webkit-font-smoothing: antialiased;
  font-size: 15px; line-height: 1.55;
}
button { font-family: inherit; cursor: pointer; border: none; outline: none; background: none; color: inherit; font-size: inherit; transition: transform .16s var(--ease), opacity .16s; }
button:active { transform: scale(.975); }
input, select, textarea {
  font-family: inherit; font-size: 15px; outline: none;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; width: 100%; background: #fff; color: var(--text);
  -webkit-appearance: none; transition: border-color .18s, box-shadow .18s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,115,232,.12); }
textarea { resize: none; }
svg { flex-shrink: 0; }

/* ===== App Shell ===== */
#app {
  display: flex; flex-direction: column; height: 100%; width: 100%;
  position: relative; background: var(--bg);
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bot);
}

/* ===== Role Screen ===== */
.role-screen {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 32px 24px;
  background: radial-gradient(120% 80% at 50% 0%, #2f8bf5 0%, #1a73e8 42%, #14509c 100%);
}
.role-screen .logo {
  width: 70px; height: 70px; background: rgba(255,255,255,.16); border-radius: 18px;
  display: flex; align-items: center; justify-content: center; margin-bottom: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
  animation: logoPop .55s var(--ease) both;
}
.role-screen .logo svg { width: 36px; height: 36px; fill: #fff; }
.role-screen h1 { color: #fff; font-size: 26px; font-weight: 600; margin-bottom: 8px; letter-spacing: 1.5px; }
.role-screen p { color: rgba(255,255,255,.72); font-size: 14px; margin-bottom: 44px; }
.role-cards { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 14px; }
.role-card {
  background: #fff; border-radius: 16px; padding: 20px; display: flex; align-items: center; gap: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,.14); cursor: pointer;
  transition: transform .18s var(--ease), box-shadow .18s;
  animation: cardIn .45s var(--ease) both;
}
.role-card:nth-child(2) { animation-delay: .1s; }
.role-card:active { transform: scale(.97); box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.role-card .role-icon { width: 50px; height: 50px; border-radius: 14px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.role-card .role-icon.sales { background: var(--primary-light); }
.role-card .role-icon.mgr { background: var(--warning-light); }
.role-card .role-icon svg { width: 26px; height: 26px; }
.role-card .role-info { flex: 1; }
.role-card .role-name { font-size: 17px; font-weight: 600; }
.role-card .role-desc { font-size: 13px; color: var(--text-hint); margin-top: 3px; }

/* ===== Top Bar ===== */
.top-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; height: var(--topbar-h); flex-shrink: 0;
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border-light);
  z-index: 20;
}
.top-bar .left { display: flex; align-items: center; gap: 10px; }
.top-bar .back-btn { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: background .16s; margin-left: -8px; }
.top-bar .back-btn:active { background: rgba(0,0,0,.05); }
.top-bar .back-btn svg { width: 22px; height: 22px; fill: var(--text); }
.top-bar .title { font-size: 17px; font-weight: 600; letter-spacing: .3px; }
.top-bar .right { display: flex; align-items: center; gap: 8px; }
.top-bar .action-btn { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: background .16s; position: relative; }
.top-bar .action-btn:active { background: rgba(0,0,0,.05); }
.top-bar .action-btn svg { width: 22px; height: 22px; fill: var(--text-secondary); }
.top-bar .action-btn .dot-badge { position: absolute; top: 3px; right: 3px; width: 9px; height: 9px; background: var(--danger); border-radius: 50%; border: 2px solid #fff; animation: dotPulse 2s infinite; }
.status-badge { font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: 11px; }
.status-badge.online { background: var(--success-light); color: var(--success); }
.status-badge.offline { background: var(--danger-light); color: var(--danger); }
.status-badge.danger { background: var(--danger-light); color: var(--danger); }
.status-badge.gray { background: #f1f4f8; color: var(--text-hint); }
.status-badge.gray { background: var(--bg); color: var(--text-hint); }

/* ===== Content ===== */
.content { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 16px 16px 22px; }

/* ===== Cards ===== */
.card { background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 14px; overflow: hidden; }
.card-header { padding: 16px 16px 10px; display: flex; align-items: center; justify-content: space-between; }
.card-header h3 { font-size: 16px; font-weight: 600; letter-spacing: .2px; }
.card-header .more { font-size: 13px; color: var(--primary); font-weight: 500; }
.card-header .more.link { display: flex; align-items: center; gap: 2px; }
.card-body { padding: 0 16px 16px; }
.card-footer { padding: 12px 16px; border-top: 1px solid var(--border-light); display: flex; gap: 10px; }

/* ===== Stats Grid ===== */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.stats-grid.cols-4 { grid-template-columns: repeat(4, 1fr); gap: 9px; }
.stats-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.stat-card {
  background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 8px; text-align: center; position: relative; overflow: hidden;
}
.stat-card .stat-value { font-size: 24px; font-weight: 700; color: var(--primary); line-height: 1.2; letter-spacing: -.5px; }
.stat-card .stat-value.sm { font-size: 18px; }
.stat-card .stat-value.warn { color: var(--warning); }
.stat-card .stat-value.danger { color: var(--danger); }
.stat-card .stat-value.success { color: var(--success); }
.stat-card .stat-label { font-size: 12px; color: var(--text-hint); margin-top: 4px; }
.stat-card .stat-icon { width: 26px; height: 26px; margin: 0 auto 7px; display: flex; align-items: center; justify-content: center; border-radius: 9px; }
.stat-card .stat-icon svg { width: 17px; height: 17px; }
.stat-card .stat-icon.tint-blue { background: var(--primary-light); }
.stat-card .stat-icon.tint-blue svg { fill: var(--primary); }
.stat-card .stat-icon.tint-green { background: var(--success-light); }
.stat-card .stat-icon.tint-green svg { fill: var(--success); }
.stat-card .stat-icon.tint-orange { background: var(--warning-light); }
.stat-card .stat-icon.tint-orange svg { fill: var(--warning); }
.stat-card .stat-icon.tint-purple { background: var(--purple-light); }
.stat-card .stat-icon.tint-purple svg { fill: var(--purple); }
/* 达标类数字：0/5 里的分母 */
.stat-card .stat-value .goal-total { font-size: 13px; font-weight: 600; color: var(--text-hint); letter-spacing: 0; margin-left: 1px; }
/* 四列紧凑：375 屏每格约 87px */
.stats-grid.cols-4 .stat-card { padding: 14px 6px; }
.stats-grid.cols-4 .stat-value { font-size: 20px; }
.stats-grid.cols-4 .stat-value .goal-total { font-size: 12px; }
.stats-grid.cols-4 .stat-label { font-size: 12px; }

/* ===== Buttons ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 13px 20px; border-radius: var(--radius-sm); font-weight: 500; font-size: 15px; transition: all .16s var(--ease); text-align: center; }
.btn:active { transform: scale(.975); opacity: .92; }
.btn-primary { background: linear-gradient(135deg, #2f8bf5, var(--primary)); color: #fff; width: 100%; height: 50px; font-size: 16px; font-weight: 600; border-radius: var(--radius); box-shadow: 0 6px 18px rgba(26,115,232,.28); }
.btn-primary:active { background: var(--primary-dark); box-shadow: 0 3px 10px rgba(26,115,232,.24); }
.btn-primary:disabled { opacity: .55; pointer-events: none; box-shadow: none; }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid rgba(26,115,232,.45); }
.btn-outline:active { background: var(--primary-light); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: var(--bg); color: var(--text-secondary); }
.btn-sm { padding: 9px 15px; font-size: 14px; border-radius: var(--radius-sm); }
.btn-xs { padding: 7px 12px; font-size: 13px; border-radius: 7px; }
.btn-block { width: 100%; }

/* ===== Form ===== */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 14px; font-weight: 500; color: var(--text-secondary); margin-bottom: 7px; }
.form-hint { font-size: 12px; color: var(--text-hint); margin-top: 5px; line-height: 1.45; }
.alert .alert-icon { width: 15px; height: 15px; flex-shrink: 0; fill: var(--primary); }
.required::after { content: ' *'; color: var(--danger); }
.radio-group { display: flex; flex-wrap: wrap; gap: 9px; }
.radio-chip {
  padding: 9px 15px; border: 1px solid var(--border); border-radius: 20px;
  font-size: 14px; color: var(--text-secondary); transition: all .16s var(--ease); cursor: pointer;
}
.radio-chip.active { background: var(--primary-light); border-color: var(--primary); color: var(--primary); font-weight: 500; }
.radio-chip:active { transform: scale(.95); }

/* ===== Map ===== */
.map-container { width: 100%; height: 240px; background: linear-gradient(135deg, #e8f0fe 0%, #d2e3fc 100%); border-radius: var(--radius); position: relative; overflow: hidden; margin-bottom: 16px; }
.map-container .map-grid { position: absolute; inset: 0; background-image: linear-gradient(rgba(26,115,232,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(26,115,232,.06) 1px, transparent 1px); background-size: 30px 30px; }
.map-container .map-road { position: absolute; background: rgba(255,255,255,.8); }
.map-dot { width: 13px; height: 13px; background: var(--danger); border-radius: 50%; position: absolute; box-shadow: 0 0 0 4px rgba(217,48,38,.2); animation: pulse-dot 2s infinite; z-index: 2; }
.map-dot.online { background: var(--success); box-shadow: 0 0 0 4px rgba(13,144,79,.2); }
.map-dot.warn { background: var(--warning); box-shadow: 0 0 0 4px rgba(227,116,0,.2); }
.map-dot.labeled::after { content: attr(data-label); position: absolute; top: 17px; left: 50%; transform: translateX(-50%); background: rgba(31,35,41,.88); color: #fff; font-size: 11px; padding: 3px 7px; border-radius: 4px; white-space: nowrap; }

/* ===== List ===== */
.list-item { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--border-light); }
.list-item:last-child { border-bottom: none; }
.list-item .avatar { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 600; color: #fff; flex-shrink: 0; }
.list-item .info { flex: 1; min-width: 0; }
.list-item .info .name { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .info .detail { font-size: 13px; color: var(--text-hint); margin-top: 3px; line-height: 1.5; word-break: break-word; }
.list-item .arrow { color: var(--text-hint); }
.badge { font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: 11px; flex-shrink: 0; }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-info { background: var(--primary-light); color: var(--primary); }
.badge-gray { background: var(--bg); color: var(--text-hint); }

/* ===== Timeline ===== */
.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 7px; bottom: 7px; width: 2px; background: var(--border); }
.timeline-item { position: relative; padding-bottom: 16px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before { content: ''; position: absolute; left: -20px; top: 5px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--primary); background: #fff; }
.timeline-item.done::before { border-color: var(--success); background: var(--success); }
.timeline-item.warn::before { border-color: var(--warning); background: var(--warning); }
.timeline-item .time { font-size: 12px; color: var(--text-hint); margin-bottom: 3px; font-weight: 500; }
.timeline-item .content-text { font-size: 14px; }
.timeline-item .sub-text { font-size: 12px; color: var(--text-hint); margin-top: 2px; }

/* ===== Camera ===== */
.camera-frame {
  width: 100%; height: 180px; background: linear-gradient(135deg, #2a2d31 0%, #3c4043 100%);
  border-radius: var(--radius); display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 10px; cursor: pointer; transition: opacity .16s, transform .16s var(--ease);
  position: relative; overflow: hidden; margin-bottom: 14px;
}
.camera-frame:active { opacity: .85; transform: scale(.99); }
.camera-frame svg { width: 36px; height: 36px; fill: rgba(255,255,255,.55); }
.camera-frame .camera-text { color: rgba(255,255,255,.62); font-size: 13px; }
.camera-frame .watermark-preview { position: absolute; bottom: 10px; left: 10px; right: 10px; background: rgba(0,0,0,.66); color: rgba(255,255,255,.88); font-size: 11px; padding: 6px 9px; border-radius: 6px; font-family: 'Courier New', monospace; line-height: 1.35; }

/* ===== Tab Bar（常驻底部） ===== */
.tab-bar {
  display: flex; align-items: stretch;
  background: rgba(255,255,255,.94);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid var(--border-light);
  box-shadow: 0 -4px 20px rgba(16,24,40,.06);
  flex-shrink: 0;
  height: var(--tabbar-h);
  padding-bottom: var(--safe-bot);
  z-index: 30;
}
.tab-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 6px 4px; transition: color .18s var(--ease); cursor: pointer; color: var(--text-hint); position: relative;
  -webkit-tap-highlight-color: transparent;
}
.tab-item.active { color: var(--primary); }
.tab-item.active::before {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 26px; height: 3px; border-radius: 0 0 4px 4px;
  background: linear-gradient(90deg, #2f8bf5, var(--primary));
}
.tab-item svg { width: 24px; height: 24px; fill: currentColor; transition: transform .22s var(--ease); }
.tab-item.active svg { transform: translateY(-1px) scale(1.06); }
.tab-item .tab-label { font-size: 12px; font-weight: 500; letter-spacing: .2px; }
.tab-item:active svg { transform: scale(.9); }

/* ===== Page（关键：subpage 用 flex 撑开，tab-bar 才能常驻） ===== */
.page { display: none; flex-direction: column; height: 100%; min-height: 0; }
.page.active { display: flex; }
.subpage { display: none; flex-direction: column; flex: 1; min-height: 0; }
.subpage.active { display: flex; }

/* ===== Section Title ===== */
.section-title { font-size: 12px; font-weight: 600; color: var(--text-hint); letter-spacing: .6px; margin-bottom: 10px; padding: 0 2px; display: flex; align-items: center; gap: 6px; }
.section-title::before { content: ''; width: 3px; height: 12px; border-radius: 2px; background: var(--primary); opacity: .85; }

/* ===== Progress ===== */
.progress-bar { height: 6px; background: var(--border-light); border-radius: 4px; overflow: hidden; margin-top: 7px; }
.progress-fill { height: 100%; border-radius: 4px; transition: width .8s var(--ease); }
.progress-fill.blue { background: linear-gradient(90deg, #2f8bf5, var(--primary)); }
.progress-fill.green { background: linear-gradient(90deg, #2ecc71, var(--success)); }
.progress-fill.orange { background: linear-gradient(90deg, #ffa94d, var(--warning)); }

/* ===== Ranking ===== */
.rank-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border-light); }
.rank-row:last-child { border-bottom: none; }
.rank-num { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.rank-num.gold { background: var(--warning-light); color: var(--warning); }
.rank-num.silver { background: #eceff1; color: var(--text-secondary); }
.rank-num.bronze { background: var(--danger-light); color: var(--danger); }
.rank-num.normal { background: var(--bg); color: var(--text-hint); }
.rank-info { flex: 1; }
.rank-info .name { font-size: 14px; font-weight: 500; }
.rank-info .sub { font-size: 12px; color: var(--text-hint); margin-top: 2px; }
.rank-score { font-size: 17px; font-weight: 700; color: var(--primary); }

/* ===== Alert ===== */
.alert { padding: 13px 14px; border-radius: var(--radius-sm); margin-bottom: 13px; display: flex; gap: 10px; align-items: flex-start; }
.alert-warning { background: var(--warning-light); border: 1px solid #fde293; }
.alert-danger { background: var(--danger-light); border: 1px solid #f5c6c2; }
.alert-info { background: var(--primary-light); border: 1px solid #c6dafc; }
.alert .alert-text { font-size: 13px; line-height: 1.5; flex: 1; }
.alert .alert-text strong { font-weight: 600; }

/* ===== Empty ===== */
.empty-state { text-align: center; padding: 40px 20px; }
.empty-state svg { width: 44px; height: 44px; fill: var(--border); margin-bottom: 12px; }
.empty-state .empty-text { font-size: 14px; color: var(--text-hint); }

/* ===== Filter Tabs ===== */
.filter-tabs { display: flex; gap: 8px; margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.filter-tabs::-webkit-scrollbar { display: none; }
.filter-tab { padding: 8px 15px; border-radius: 16px; font-size: 13px; background: #fff; color: var(--text-secondary); white-space: nowrap; border: 1px solid var(--border); cursor: pointer; flex-shrink: 0; transition: all .18s var(--ease); }
.filter-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 4px 12px rgba(26,115,232,.26); font-weight: 500; }

/* ===== Search ===== */
.search-bar { display: flex; gap: 10px; margin-bottom: 14px; }
.search-bar input { flex: 1; background: #fff; }

/* ===== Store Card ===== */
.store-card { background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 12px; overflow: hidden; transition: transform .16s var(--ease), box-shadow .16s; }
.store-card:active { transform: scale(.99); }
.store-card .sc-body { padding: 14px 16px; }
.store-card .sc-title { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.store-card .sc-title .avatar { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 600; color: #fff; flex-shrink: 0; }
.store-card .sc-title .sc-name { flex: 1; font-size: 15px; font-weight: 600; }
.store-card .sc-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.store-card .sc-tag { font-size: 11px; padding: 3px 9px; border-radius: 5px; background: var(--bg); color: var(--text-secondary); }
.store-card .sc-tag.type { background: var(--primary-light); color: var(--primary); }
.store-card .sc-meta { font-size: 12px; color: var(--text-hint); display: flex; flex-direction: column; gap: 5px; }
.store-card .sc-meta span { display: flex; align-items: center; gap: 6px; }
.store-card .sc-meta svg { width: 14px; height: 14px; fill: var(--text-hint); }
.store-card .sc-footer { padding: 11px 16px; border-top: 1px solid var(--border-light); display: flex; gap: 10px; }
.store-card .sc-footer .btn { flex: 1; }

/* ===== Detail List ===== */
.detail-row { display: flex; padding: 12px 0; border-bottom: 1px solid var(--border-light); }
.detail-row:last-child { border-bottom: none; }
.detail-row .label { width: 92px; font-size: 13px; color: var(--text-hint); flex-shrink: 0; }
.detail-row .value { flex: 1; font-size: 14px; }

/* ===== Photo Grid ===== */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo-item { aspect-ratio: 1; background: linear-gradient(135deg, #e8eaed, #f1f3f4); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; transition: transform .16s var(--ease); }
.photo-item svg { width: 24px; height: 24px; fill: #bdc1c6; }
.photo-item .pt-label { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(31,35,41,.7); color: #fff; font-size: 11px; text-align: center; padding: 3px; }
.photo-item.add { background: var(--bg); border: 1px dashed var(--border); }
.photo-item.add svg { fill: var(--text-hint); }
.photo-item.add:active { transform: scale(.96); }

/* ===== Chart ===== */
.bar-chart { display: flex; align-items: flex-end; gap: 7px; height: 130px; padding: 0 2px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; justify-content: flex-end; }
.bar-col .bar { width: 100%; max-width: 28px; background: linear-gradient(180deg, #4a9dff, var(--primary)); border-radius: 4px 4px 0 0; transition: height .7s var(--ease); }
.bar-col .bar.alt { background: linear-gradient(180deg, #34d07f, var(--success)); }
.bar-col .bar-val { font-size: 11px; color: var(--text-secondary); font-weight: 600; }
.bar-col .bar-label { font-size: 11px; color: var(--text-hint); }

/* ===== Trend ===== */
.trend-chart { display: flex; gap: 3px; align-items: flex-end; justify-content: center; height: 90px; }
.trend-bar { width: 14px; border-radius: 3px 3px 0 0; min-height: 4px; }

/* ===== Segment ===== */
.segment { display: flex; background: var(--bg); border-radius: var(--radius-sm); padding: 4px; margin-bottom: 14px; }
.segment-item { flex: 1; text-align: center; padding: 8px; font-size: 13px; color: var(--text-secondary); border-radius: 7px; cursor: pointer; transition: all .18s var(--ease); }
.segment-item.active { background: #fff; color: var(--primary); font-weight: 600; box-shadow: var(--shadow); }

/* ===== Toggle ===== */
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--border-light); }
.toggle-row:last-child { border-bottom: none; }
.toggle-row .tr-left { display: flex; align-items: center; gap: 11px; }
.toggle-row .tr-title { font-size: 15px; font-weight: 500; }
.toggle-row .tr-desc { font-size: 13px; color: var(--text-hint); margin-top: 2px; }
.toggle { width: 46px; height: 26px; background: var(--border); border-radius: 13px; position: relative; cursor: pointer; transition: background .22s var(--ease); flex-shrink: 0; }
.toggle.on { background: var(--primary); }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; background: #fff; border-radius: 50%; transition: transform .22s var(--ease); box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.toggle.on::after { transform: translateX(20px); }

/* ===== Menu List ===== */
.menu-list .menu-item { display: flex; align-items: center; gap: 12px; padding: 15px 16px; border-bottom: 1px solid var(--border-light); cursor: pointer; transition: background .16s; }
.menu-list .menu-item:last-child { border-bottom: none; }
.menu-list .menu-item:active { background: var(--bg); }
.menu-list .menu-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.menu-list .menu-icon svg { width: 19px; height: 19px; }
.menu-list .menu-info { flex: 1; }
.menu-list .menu-title { font-size: 15px; font-weight: 500; }
.menu-list .menu-desc { font-size: 12px; color: var(--text-hint); margin-top: 2px; }
.menu-list .menu-arrow svg { width: 18px; height: 18px; fill: var(--text-hint); }

/* ===== User Header ===== */
.user-header { background: radial-gradient(120% 90% at 20% 0%, #2f8bf5 0%, var(--primary) 45%, var(--primary-dark) 100%); padding: 20px 16px 18px; color: #fff; }
.user-header .uh-top { display: flex; align-items: center; gap: 14px; }
.user-header .uh-avatar { width: 54px; height: 54px; border-radius: 50%; background: rgba(255,255,255,.22); display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 600; border: 2px solid rgba(255,255,255,.3); }
.user-header .uh-info { flex: 1; }
.user-header .uh-name { font-size: 18px; font-weight: 600; }
.user-header .uh-role { font-size: 13px; opacity: .82; margin-top: 3px; }
.user-header .uh-stats { display: flex; justify-content: space-around; margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.15); }
.user-header .uh-stat { text-align: center; }
.user-header .uh-stat .v { font-size: 20px; font-weight: 700; }
.user-header .uh-stat .l { font-size: 11px; opacity: .78; margin-top: 3px; }

/* ===== Avatar colors ===== */
.avatar.blue { background: linear-gradient(135deg, #4a9dff, #1558b0); }
.avatar.green { background: linear-gradient(135deg, #34d07f, #0d904f); }
.avatar.orange { background: linear-gradient(135deg, #ffb057, #e37400); }
.avatar.purple { background: linear-gradient(135deg, #b46ae0, #7b1fa2); }
.avatar { background: linear-gradient(135deg, #9aa4b2, #6b7280); color: #fff; }

/* ===== 动画 ===== */
@keyframes cardIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes logoPop { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: scale(1); } }
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 4px rgba(217,48,38,.2); }
  50% { box-shadow: 0 0 0 9px rgba(217,48,38,.06); }
}
@keyframes dotPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: .8; }
}

/* ===== Landscape ===== */
@media (orientation: landscape) and (max-height: 500px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .map-container { height: 170px; }
  .camera-frame { height: 120px; }
  .content { padding: 12px 16px; }
  .bar-chart { height: 90px; }
}

@media (orientation: landscape) and (min-width: 700px) {
  .role-cards { max-width: 620px; flex-direction: row; }
  .role-card { flex: 1; }
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .content { padding: 14px 20px; }
}

/* ===== Tablet / Desktop（模拟手机宽度居中） ===== */
@media (min-width: 768px) {
  body { background: #e9edf2; }
  #app { max-width: 430px; margin: 0 auto; box-shadow: 0 0 40px rgba(16,24,40,.16); background: var(--bg); border-radius: 0; }
  .role-screen { padding: 48px 24px; }
  .role-cards { max-width: 380px; }
}

/* ===== Small ===== */
@media (max-height: 560px) {
  .role-screen .logo { width: 54px; height: 54px; margin-bottom: 14px; }
  .role-screen h1 { font-size: 22px; }
  .role-screen p { margin-bottom: 26px; }
  .map-container { height: 170px; }
}

/* ===== Safe Area ===== */
@supports (padding: max(0px)) {
  .content { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .top-bar { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
}

/* ===== 间距工具类（替代零散内联 margin） ===== */
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
