/* ============================================================
   颐享 Mobile UI Design System
   ============================================================ */
:root {
  --color-primary: #7C3AED;
  --color-primary-dark: #5B21B6;
  --color-cs: #2563EB;
  --color-cs-dark: #1D4ED8;
  --color-finance: #059669;
  --color-finance-dark: #047857;
  --color-admin: #7C3AED;
  --color-worker: #D97706;
  --color-worker-dark: #B45309;
  --color-bg: #F5F5F7;
  --color-card: #FFFFFF;
  --color-text: #1C1C1E;
  --color-text-2: #6B7280;
  --color-border: #E5E7EB;
  --color-danger: #DC2626;
  --color-success: #16A34A;
  --color-warning: #D97706;
  --radius-card: 16px;
  --radius-btn: 12px;
  --shadow-card: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --header-h: 56px;
  --tabbar-h: 56px;
}

/* ── 页面容器 ── */
.mu-page {
  min-height: 100vh;
  background: var(--color-bg);
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
}

/* ── 顶部导航 ── */
.mu-header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
  background: #fff;
  display: flex; align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid var(--color-border);
  gap: 12px;
}
.mu-header-title {
  flex: 1; font-size: 17px; font-weight: 600;
  color: var(--color-text); text-align: center;
}
.mu-header-back {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--color-bg);
  border: none; cursor: pointer; font-size: 18px; color: var(--color-text);
  flex-shrink: 0;
}
.mu-header-action {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: none; cursor: pointer;
  font-size: 18px; color: var(--color-text-2); flex-shrink: 0;
}

/* ── 卡片 ── */
.mu-card {
  background: var(--color-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 16px;
  margin: 0 16px 12px;
}
.mu-card-title {
  font-size: 13px; color: var(--color-text-2);
  font-weight: 500; margin-bottom: 12px;
}

/* ── 统计格子 ── */
.mu-stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 1px; background: var(--color-border);
  border-radius: 12px; overflow: hidden; margin: 0 16px 12px;
}
.mu-stats-2 { grid-template-columns: repeat(2, 1fr); }
/* 4 items displayed in 2-column grid */
.mu-stats-4 { grid-template-columns: repeat(2, 1fr); }
.mu-stat {
  background: var(--color-card);
  padding: 16px 8px; text-align: center;
}
.mu-stat-val {
  font-size: 24px; font-weight: 700; color: var(--color-text); line-height: 1;
}
.mu-stat-val.primary { color: var(--color-primary); }
.mu-stat-val.success { color: var(--color-success); }
.mu-stat-val.warning { color: var(--color-warning); }
.mu-stat-val.danger  { color: var(--color-danger);  }
.mu-stat-label {
  font-size: 12px; color: var(--color-text-2); margin-top: 4px;
}

/* ── 列表项 ── */
.mu-list { margin: 0 16px 12px; background: var(--color-card); border-radius: var(--radius-card); overflow: hidden; }
.mu-list-item {
  display: flex; align-items: center;
  padding: 14px 16px; gap: 12px;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer; transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.mu-list-item:last-child { border-bottom: none; }
.mu-list-item:active { background: var(--color-bg); }
.mu-list-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.mu-list-body { flex: 1; min-width: 0; }
.mu-list-title {
  font-size: 15px; font-weight: 500; color: var(--color-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mu-list-sub {
  font-size: 12px; color: var(--color-text-2); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mu-list-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.mu-chevron { color: #C7C7CC; font-size: 14px; }

/* ── 状态徽章 ── */
.mu-badge {
  display: inline-flex; align-items: center;
  border-radius: 20px; padding: 3px 10px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
}
.mu-badge-pending  { background: #FEF3C7; color: #92400E; }
.mu-badge-progress { background: #DBEAFE; color: #1E40AF; }
.mu-badge-success  { background: #D1FAE5; color: #065F46; }
.mu-badge-danger   { background: #FEE2E2; color: #991B1B; }
.mu-badge-gray     { background: #F3F4F6; color: #6B7280; }
.mu-badge-primary  { background: #EDE9FE; color: #5B21B6; }

/* ── 底部标签栏 ── */
.mu-tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--color-border);
  display: flex; align-items: flex-start;
  z-index: 200;
}
.mu-tab {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding-top: 8px; height: var(--tabbar-h);
  cursor: pointer; border: none; background: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.mu-tab-icon { font-size: 22px; line-height: 1; }
.mu-tab-label { font-size: 10px; margin-top: 3px; color: var(--color-text-2); }
.mu-tab.active .mu-tab-icon,
.mu-tab.active .mu-tab-label { color: var(--color-primary); }
.mu-tab-badge {
  position: absolute; top: 4px; right: calc(50% - 18px);
  background: var(--color-danger); color: #fff;
  font-size: 10px; min-width: 16px; height: 16px;
  border-radius: 8px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center;
}

/* ── 按钮 ── */
.mu-btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: none; cursor: pointer; font-size: 15px; font-weight: 500;
  border-radius: var(--radius-btn); transition: opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.mu-btn:active { opacity: 0.75; }
.mu-btn-primary {
  background: var(--color-primary); color: #fff;
  height: 48px; padding: 0 24px;
}
.mu-btn-outline {
  background: none; border: 1.5px solid var(--color-primary);
  color: var(--color-primary); height: 36px; padding: 0 16px;
}
.mu-btn-sm {
  height: 30px; padding: 0 12px; font-size: 13px; border-radius: 8px;
}
.mu-btn-danger { background: var(--color-danger); color: #fff; }
.mu-btn-success { background: var(--color-success); color: #fff; }
.mu-btn-block { width: 100%; }

/* ── 分段控制器（Tab切换） ── */
.mu-seg {
  display: flex; background: var(--color-bg);
  border-radius: 10px; padding: 3px; margin: 12px 16px;
}
.mu-seg-item {
  flex: 1; text-align: center; padding: 7px 0;
  font-size: 14px; border-radius: 8px; cursor: pointer;
  color: var(--color-text-2); transition: all 0.2s;
  border: none; background: none;
}
.mu-seg-item.active {
  background: #fff; color: var(--color-text);
  font-weight: 600; box-shadow: var(--shadow-card);
}

/* ── 表单 ── */
.mu-form { margin: 0 16px 12px; }
.mu-form-item { margin-bottom: 16px; }
.mu-form-label { font-size: 13px; color: var(--color-text-2); margin-bottom: 6px; }
.mu-input {
  width: 100%; height: 44px; border-radius: 10px;
  border: 1.5px solid var(--color-border); padding: 0 14px;
  font-size: 15px; color: var(--color-text);
  background: #fff; outline: none; box-sizing: border-box;
  transition: border-color 0.2s;
}
.mu-input:focus { border-color: var(--color-primary); }
.mu-textarea {
  width: 100%; border-radius: 10px;
  border: 1.5px solid var(--color-border); padding: 12px 14px;
  font-size: 15px; color: var(--color-text);
  background: #fff; outline: none; resize: none;
  box-sizing: border-box; font-family: inherit;
  transition: border-color 0.2s;
}
.mu-textarea:focus { border-color: var(--color-primary); }

/* ── 空状态 ── */
.mu-empty {
  display: flex; flex-direction: column;
  align-items: center; padding: 60px 0;
}
.mu-empty-icon { font-size: 48px; margin-bottom: 12px; }
.mu-empty-text { font-size: 14px; color: var(--color-text-2); }

/* ── 骨架屏 ── */
@keyframes mu-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.mu-skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: mu-shimmer 1.5s infinite;
  border-radius: 6px;
}

/* ── 分隔标题 ── */
.mu-section-title {
  font-size: 13px; font-weight: 600; color: var(--color-text-2);
  padding: 16px 16px 8px; text-transform: uppercase; letter-spacing: 0.5px;
}

/* ── 角色主题色覆盖 ── */
.theme-cs    { --color-primary: var(--color-cs); --color-primary-dark: var(--color-cs-dark); }
.theme-finance { --color-primary: var(--color-finance); --color-primary-dark: var(--color-finance-dark); }
.theme-worker  { --color-primary: var(--color-worker); --color-primary-dark: var(--color-worker-dark); }

/* ── 模态底部弹窗 ── */
.mu-sheet-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  z-index: 300; display: none; align-items: flex-end;
}
.mu-sheet-mask.open { display: flex; }
.mu-sheet {
  background: #fff; width: 100%;
  border-radius: 20px 20px 0 0;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  max-height: 85vh; overflow-y: auto;
}
.mu-sheet-handle {
  width: 36px; height: 4px; background: var(--color-border);
  border-radius: 2px; margin: 0 auto 16px;
}
.mu-sheet-title {
  font-size: 17px; font-weight: 600; color: var(--color-text);
  margin-bottom: 16px; text-align: center;
}

/* ── Toast ── */
.mu-toast {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.75); color: #fff;
  padding: 10px 20px; border-radius: 24px;
  font-size: 14px; z-index: 9999; pointer-events: none;
  opacity: 0; transition: opacity 0.2s;
}
.mu-toast.show { opacity: 1; }

/* ── 首屏问候区 ── */
.mu-greeting {
  padding: 20px 16px 12px;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: #fff;
}
.mu-greeting-name { font-size: 22px; font-weight: 700; }
.mu-greeting-sub  { font-size: 14px; opacity: 0.8; margin-top: 4px; }
.mu-greeting-date { font-size: 12px; opacity: 0.6; margin-top: 2px; }

/* ── 加载中 ── */
.mu-loading {
  display: flex; align-items: center; justify-content: center;
  padding: 40px 0;
}
@keyframes mu-spin {
  to { transform: rotate(360deg); }
}
.mu-spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  animation: mu-spin 0.8s linear infinite;
}
