/* mobile.css — 微信经营看板样式 */
:root {
  --brand: #005BAC;
  --brand-dark: #004A8E;
  --brand-light: #E8F1FB;
  --red: #D92D20;
  --red-light: #FFF1F0;
  --green: #12A150;
  --green-light: #E8F8EF;
  --orange: #F79009;
  --orange-light: #FFF4E6;
  --gray-50: #F5F7FA;
  --gray-100: #F2F4F7;
  --gray-200: #E4E7EC;
  --gray-300: #D0D5DD;
  --gray-500: #7D8696;
  --gray-700: #475467;
  --gray-900: #101828;
  --white: #FFFFFF;
  --brand-dark: #004A8E;
  --font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 12px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  font-family: var(--font-family, "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);
  background: var(--gray-50);
  color: var(--gray-900);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.view { display: none; min-height: 100vh; }
.view.active { display: block; }

/* ─── 登录页 ─── */
.login-box {
  max-width: 360px; margin: 0 auto; padding: 60px 24px 24px; text-align: center;
}
.login-logo { width: 64px; height: 64px; margin: 0 auto 16px; }
.login-title { font-size: 22px; color: var(--brand); margin-bottom: 4px; }
.login-subtitle { font-size: 14px; color: var(--gray-500); margin-bottom: 32px; }
.login-hint { font-size: 12px; color: var(--gray-500); margin-top: 20px; }
.error-text { color: var(--red); font-size: 14px; margin-top: 12px; min-height: 20px; }

/* ─── 通用表单 ─── */
.field { margin-bottom: 16px; text-align: left; }
.field label { display: block; font-size: 14px; font-weight: 500; color: var(--gray-700); margin-bottom: 4px; }
.field input, .field select, .field textarea {
  width: 100%; height: 48px; padding: 0 14px; font-size: 16px;
  border: 1px solid var(--gray-300); border-radius: 8px; background: var(--white); color: var(--gray-900);
  appearance: none; -webkit-appearance: none;
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0, 91, 172, 0.12);
}

.btn-primary {
  width: 100%; height: 48px; font-size: 16px; font-weight: 600; color: var(--white);
  background: var(--brand); border: none; border-radius: 8px; cursor: pointer;
  transition: background 0.2s;
}
.btn-primary:active { background: var(--brand-dark); }
.btn-primary:disabled { background: var(--gray-300); cursor: not-allowed; }

.btn-secondary {
  width: 100%; height: 48px; font-size: 16px; font-weight: 500; color: var(--brand);
  background: var(--white); border: 1px solid var(--brand); border-radius: 8px; cursor: pointer;
}
.btn-secondary:active { background: var(--brand-light); }

/* ─── 加载动画 ─── */
.loading-box { text-align: center; padding: 120px 24px; color: var(--gray-500); }
.spinner {
  width: 36px; height: 36px; margin: 0 auto 16px;
  border: 3px solid var(--gray-200); border-top-color: var(--brand);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── 顶部栏 ─── */
.app-header {
  position: sticky; top: 0; z-index: 100;
  background: linear-gradient(135deg, #004A8E 0%, #005BAC 50%, #0070CC 100%);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.header-top { height: 3px; background: linear-gradient(90deg, var(--brand-dark) 0%, var(--brand) 40%, var(--brand) 100%); }
.header-body {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; min-height: 48px;
}
.header-left { display: flex; align-items: center; gap: 10px; flex: none; }
.header-logo { width: 36px; height: 36px; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2)); }
.header-text { display: flex; flex-direction: column; }
.header-text strong { font-size: 17px; letter-spacing: 0.5px; }
.header-text span { font-size: 11px; color: rgba(255,255,255,0.75); letter-spacing: 1px; }
.header-title { font-size: 18px; font-weight: 600; }
.header-user {
  display: flex; align-items: center; gap: 6px; font-size: 13px;
  flex: 1 1 auto; min-width: 0; justify-content: flex-end;
}
.header-user #headerName {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 32%;
}
.role-tag {
  display: inline-block; padding: 1px 8px; border-radius: 10px;
  font-size: 11px; background: rgba(255,255,255,0.25); white-space: nowrap;
}
@media (max-width: 389px) {
  .header-body { padding: 12px; }
  .header-user #headerName { max-width: 26%; }
  .role-tag { padding: 1px 6px; }
}

/* ─── KPI 卡片区 ─── */
.kpi-section {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  padding: 12px 12px 0;
}
.kpi-card {
  background: var(--white); border-radius: 10px; padding: 10px 10px 8px;
  text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.kpi-card .kpi-label { display: block; font-size: 11px; color: var(--gray-500); line-height: 1.3; }
.kpi-card .kpi-value { display: block; font-size: 22px; font-weight: 700; margin: 2px 0; line-height: 1.2; }
.kpi-card .kpi-hint { display: block; font-size: 10px; color: var(--gray-500); }
.kpi-card.tone-good .kpi-value { color: var(--green); }
.kpi-card.tone-warn .kpi-value { color: var(--orange); }
.kpi-card.tone-bad .kpi-value { color: var(--red); }
.kpi-card.tone-brand .kpi-value { color: var(--brand); }

/* ─── Tab 导航 ─── */
.tab-nav {
  display: flex; overflow-x: auto; -webkit-overflow-scrolling: touch;
  background: var(--white); border-bottom: 1px solid var(--gray-200);
  padding: 0 8px; margin-top: 12px;
  scrollbar-width: none;
}
.tab-nav::-webkit-scrollbar { display: none; }
.tab-btn {
  flex: none; padding: 10px 14px; font-size: 14px; color: var(--gray-700);
  border: none; background: none; cursor: pointer; white-space: nowrap;
  position: relative; transition: color 0.2s;
}
.tab-btn.active { color: var(--brand); font-weight: 600; }
.tab-btn.active::after {
  content: ''; position: absolute; bottom: 0; left: 14px; right: 14px;
  height: 2px; background: var(--brand); border-radius: 1px;
}
.tab-btn .badge {
  display: inline-block; min-width: 16px; height: 16px; line-height: 16px;
  font-size: 10px; text-align: center; border-radius: 8px;
  background: var(--red); color: var(--white); padding: 0 4px; margin-left: 3px;
  vertical-align: top;
}

/* ─── 内容区 ─── */
.tab-content { padding: 12px; min-height: 40vh; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ─── 数据卡片 ─── */
.data-card {
  background: var(--white); border-radius: 10px; padding: 14px; margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.data-card-title {
  font-size: 15px; font-weight: 600; margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.data-card-title .icon { font-size: 18px; }

/* ─── 排名列表 ─── */
.rank-list { list-style: none; }
.rank-item {
  display: flex; align-items: center; padding: 10px 0;
  border-bottom: 1px solid var(--gray-100); gap: 10px;
}
.rank-item:last-child { border-bottom: none; }
.rank-num {
  width: 24px; height: 24px; line-height: 24px; text-align: center;
  border-radius: 6px; font-size: 12px; font-weight: 700; flex: none;
  background: var(--gray-100); color: var(--gray-700);
}
.rank-item:nth-child(1) .rank-num { background: #F79009; color: var(--white); }
.rank-item:nth-child(2) .rank-num { background: #98A2B3; color: var(--white); }
.rank-item:nth-child(3) .rank-num { background: #B45309; color: var(--white); }
.rank-name { flex: 1; font-size: 14px; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-value { font-size: 14px; font-weight: 600; color: var(--brand); flex: none; }
.rank-rate { font-size: 12px; color: var(--gray-500); flex: none; min-width: 48px; text-align: right; }

/* ─── 指标行 ─── */
.metric-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--gray-100);
}
.metric-row:last-child { border-bottom: none; }
.metric-label { font-size: 14px; color: var(--gray-700); }
.metric-right { display: flex; align-items: center; gap: 8px; }
.metric-value { font-size: 16px; font-weight: 700; }
.metric-unit { font-size: 12px; color: var(--gray-500); }
.status-tag {
  display: inline-block; padding: 1px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 500;
}
.status-tag.good { background: var(--green-light); color: var(--green); }
.status-tag.warn { background: var(--orange-light); color: var(--orange); }
.status-tag.bad { background: var(--red-light); color: var(--red); }

/* ─── 进度条 ─── */
.progress-bar {
  height: 6px; background: var(--gray-200); border-radius: 3px; overflow: hidden; margin-top: 4px;
}
.progress-fill {
  height: 100%; border-radius: 3px; transition: width 0.5s ease;
  background: var(--brand);
}
.progress-fill.tone-good { background: var(--green); }
.progress-fill.tone-warn { background: var(--orange); }
.progress-fill.tone-bad { background: var(--red); }

/* ─── 工单/行动列表 ─── */
.task-card {
  background: var(--white); border-radius: 10px; padding: 12px 14px; margin-bottom: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  display: flex; align-items: flex-start; gap: 10px;
}
.task-icon {
  width: 36px; height: 36px; border-radius: 8px; display: flex;
  align-items: center; justify-content: center; font-size: 16px; flex: none;
  background: var(--brand-light); color: var(--brand);
}
.task-icon.urgent { background: var(--red-light); color: var(--red); }
.task-body { flex: 1; min-width: 0; }
.task-title { font-size: 14px; font-weight: 500; margin-bottom: 2px; }
.task-meta { font-size: 12px; color: var(--gray-500); }

/* ─── 日期选择器 ─── */
.date-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0; margin-bottom: 8px;
}
.date-bar input[type="date"] {
  height: 36px; padding: 0 10px; font-size: 14px;
  border: 1px solid var(--gray-300); border-radius: 8px; background: var(--white);
}
.date-bar select {
  height: 36px; padding: 0 10px; font-size: 14px;
  border: 1px solid var(--gray-300); border-radius: 8px; background: var(--white);
  appearance: none; -webkit-appearance: none;
}

/* ─── 空状态 ─── */
.empty-state {
  text-align: center; padding: 40px 24px; color: var(--gray-500);
}
.empty-state .icon { font-size: 40px; margin-bottom: 8px; }

/* ─── 底部安全区 ─── */
.safe-bottom { height: var(--safe-bottom); }

/* ─── Phase-2 新首页底部导航（PC3B）───
   仅在进入 Phase-2 新首页时启用（容器默认 hidden，legacy 看板不出现）。
   固定底部 + iPhone/微信安全区；等分列，375/390/414 均不横向溢出。 */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bottom-nav[hidden] { display: none; }
.bottom-nav-inner { display: flex; width: 100%; }
.bottom-nav-item {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; padding: 7px 2px 6px;
  border: none; background: none; cursor: pointer;
  color: var(--gray-500); font-size: 11px; line-height: 1.2;
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav-item .bottom-nav-icon { font-size: 19px; line-height: 1.1; }
.bottom-nav-item .bottom-nav-label {
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bottom-nav-item.is-active { color: var(--brand); font-weight: 600; }
.bottom-nav-item:active { opacity: 0.6; }

/* 启用底部导航时给正文留出安全高度，避免遮挡正文按钮（含安全区） */
body.phase2-bottom-nav .tab-content {
  padding-bottom: calc(62px + var(--safe-bottom));
}
body.phase2-bottom-nav .safe-bottom { height: 0; }

/* ─── PC3B-R1：退出入口 / 我的 / 轻提示 ─── */
.header-logout {
  flex: none;
  margin-left: 4px; padding: 3px 9px; border-radius: 12px;
  font-size: 12px; color: var(--white); background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.45); cursor: pointer; white-space: nowrap;
}
.header-logout:active { opacity: 0.6; }

.me-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 0; border-bottom: 1px solid var(--gray-200); font-size: 14px;
}
.me-row:last-of-type { border-bottom: none; }
.me-label { color: var(--gray-500); }
.me-value { color: var(--gray-700); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }

.btn-logout {
  display: block; width: 100%; margin-top: 14px; padding: 12px 0;
  font-size: 15px; font-weight: 600; color: var(--white);
  background: var(--brand); border: none; border-radius: 10px; cursor: pointer;
}
.btn-logout:active { opacity: 0.75; }

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  z-index: 60; max-width: 86%;
  padding: 10px 16px; border-radius: 8px;
  background: rgba(0, 0, 0, 0.82); color: var(--white); font-size: 13px; text-align: center;
}
.toast[hidden] { display: none; }

/* ══════════════════════════════════════════════════
   Phase-2 三角色首页正式样式（PC3C）
   —— 与 docs/phase2-prototype/prototype.css 目标稿同源，
      统一并入生产样式表（不再有第二套 CSS / prototype-only 样式）。
   规范：主标题 20-24px / 区块标题 16-18px / 正文 13-15px /
        KPI 数字 18-24px / 卡片圆角 12px / 卡片间距 10-12px /
        页面左右边距 12-16px / 不使用浏览器默认 h1-h3 字号。
   ══════════════════════════════════════════════════ */

/* ① 页面容器与标题基线（禁止裸 h1/h2/h3 用浏览器默认字号） */
.tab-content { padding: 12px; }
#tabContent h1, #tabContent h2, #tabContent h3 {
  margin: 0; font-weight: 700; line-height: 1.35; font-size: 16px; color: var(--gray-900);
}

/* ② 卡片 */
.card {
  background: var(--white); border-radius: var(--radius);
  padding: 12px; margin-bottom: 10px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
}
.card-h {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 8px;
}
.card-h h2 { font-size: 16px; font-weight: 700; color: var(--gray-900); }
.card-h .more { font-size: 12px; color: var(--gray-500); flex: none; }

/* ③ 顶部状态条 / 摘要卡（2×2 或紧凑横向，随宽度自适应） */
.statbar {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px; margin-bottom: 10px;
}
.stat {
  background: var(--white); border-radius: var(--radius);
  padding: 10px 8px; text-align: center;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
}
.stat .v { font-size: 20px; font-weight: 800; line-height: 1.2; }
.stat .l { font-size: 12px; color: var(--gray-500); margin-top: 2px; }
.v-red { color: var(--red); }
.v-green { color: var(--green); }
.v-brand { color: var(--brand); }
.v-orange { color: var(--orange); }
.v-gray { color: var(--gray-700); }

/* ④ 列表项 */
.item {
  display: flex; gap: 8px; padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
}
.item:last-child { border-bottom: none; padding-bottom: 0; }
.item .no {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  color: var(--white); font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; margin-top: 2px;
  background: var(--gray-500);
}
.no-red { background: var(--red); }
.no-orange { background: var(--orange); }
.no-yellow { background: #EAAA08; }
.no-brand { background: var(--brand); }
.no-gray { background: var(--gray-500); }
.item .body { flex: 1; min-width: 0; }
.item .t1 { font-size: 14px; font-weight: 600; line-height: 1.4; color: var(--gray-900); }
.item .t2 { font-size: 13px; color: var(--gray-500); margin-top: 3px; line-height: 1.5; }
.item .t3 { font-size: 12px; color: var(--gray-500); margin-top: 3px; line-height: 1.5; }

/* ⑤ 标签 */
.tag {
  display: inline-block; padding: 1px 7px; border-radius: 6px;
  font-size: 11px; font-weight: 600; margin-right: 4px; white-space: nowrap;
}
.tag-red { background: var(--red-light); color: var(--red); }
.tag-orange { background: var(--orange-light); color: var(--orange); }
.tag-green { background: var(--green-light); color: var(--green); }
.tag-brand { background: var(--brand-light); color: var(--brand); }
.tag-gray { background: var(--gray-100); color: var(--gray-500); }

/* ⑥ 按钮（不得无必要全宽霸屏） */
.btn {
  min-height: 36px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--brand); background: var(--white); color: var(--brand);
  font-size: 13px; font-weight: 600; line-height: 1.2;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.btn:active { opacity: 0.7; }
.btn-primary { background: var(--brand); color: var(--white); border-color: var(--brand); }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 12px; }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.btn-row .btn { flex: 1 1 auto; min-width: 72px; max-width: 168px; padding: 0 8px; font-size: 12px; }
.acts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.acts .btn { min-width: 0; padding: 0 4px; font-size: 12px; }

/* ⑦ 进度条 */
.bar { height: 6px; background: var(--gray-100); border-radius: 3px; overflow: hidden; margin-top: 8px; }
.bar > i { display: block; height: 100%; border-radius: 3px; }

/* ⑧ 计数网格（承诺三宫格 / 督办四宫格） */
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.grid3 .g, .grid4 .g {
  background: var(--gray-50); border-radius: 10px; padding: 10px 4px; text-align: center;
}
.grid3 .g .n, .grid4 .g .n { font-size: 20px; font-weight: 800; line-height: 1.2; }
.grid3 .g .x, .grid4 .g .x { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

/* ⑨ 预警 2×2 */
.warns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.warns .w {
  background: var(--gray-50); border-radius: 10px; padding: 10px;
}
.warns .w .n { font-size: 18px; font-weight: 800; line-height: 1.2; }
.warns .w .x { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

/* ⑩ 提示 / 空状态（空状态必须在卡片内，不出现大段裸文字） */
.note {
  background: #FFF8E6; color: #856404; border-radius: 8px;
  padding: 8px 10px; font-size: 12px; line-height: 1.5;
}
.hint { font-size: 12px; color: var(--gray-500); padding: 8px 2px 2px; line-height: 1.5; }
.hint-center { text-align: center; padding: 16px 0; font-size: 13px; color: var(--gray-500); }
.sect-title {
  font-size: 12px; color: var(--gray-500); font-weight: 700;
  margin: 12px 2px 6px; letter-spacing: 0.5px;
}
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* ⑪ 底部动作面板（支局长 7 个管理动作） */
.sheet-mask { position: fixed; left: 0; right: 0; top: 0; bottom: 0; background: rgba(16, 24, 40, 0.45); z-index: 50; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51;
  background: var(--white); border-radius: 16px 16px 0 0;
  padding: 14px 14px calc(14px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -4px 20px rgba(16, 24, 40, 0.16);
}
.sheet-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sheet-h b { font-size: 16px; }
.sheet-x {
  font-size: 16px; color: var(--gray-500); min-width: 32px; min-height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
}
.sheet-who {
  font-size: 14px; font-weight: 600; line-height: 1.5;
  padding-bottom: 10px; border-bottom: 1px solid var(--gray-100); margin-bottom: 10px;
}
.sheet-tip { font-size: 12px; color: var(--gray-500); line-height: 1.5; margin: 8px 0 10px; }

/* ⑫ 骨架屏占位条（skeleton） */
.bar[style*="height:14px"], .bar[style*="height:12px"] { background: var(--gray-100); }

/* ─── 刷新按钮 ─── */
.refresh-bar {
  display: flex; justify-content: flex-end; padding: 0 0 8px;
}
.btn-refresh {
  font-size: 13px; color: var(--brand); background: none; border: none; cursor: pointer;
  display: flex; align-items: center; gap: 4px;
}
.btn-refresh:active { opacity: 0.6; }
