/* ===================== 枫桦健康管理中心 · 样式 ===================== */
:root {
  --bg: #f4f4f7;
  --bg-alt: #eceef2;
  --glass: rgba(255, 255, 255, 0.62);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --border: rgba(0, 0, 0, 0.06);
  --text: #1c1c1e;
  --text-secondary: #6e6e73;
  --text-tertiary: #a1a1a6;
  --accent: #0a84ff;
  --accent-soft: rgba(10, 132, 255, 0.12);
  --success: #34c759;
  --warning: #ff9f0a;
  --danger: #ff3b30;
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
  --shadow-strong: 0 16px 50px rgba(0, 0, 0, 0.12);
  --ease: cubic-bezier(0.25, 0.8, 0.25, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background:
    radial-gradient(circle at 15% 0%, #eaf3ff 0%, transparent 45%),
    radial-gradient(circle at 90% 10%, #f4ecff 0%, transparent 40%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

#app { min-height: 100%; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 10px; }

/* ===================== 通用组件 ===================== */

.glass {
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: 12px 22px;
  font-size: 15px; font-weight: 590;
  border: none; border-radius: 100px;
  cursor: pointer;
  transition: transform .18s var(--ease), opacity .18s var(--ease), background .18s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.96); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #0071e3; }
.btn-primary:disabled { background: #c7c7cc; cursor: not-allowed; }
.btn-secondary { background: rgba(120,120,128,0.12); color: var(--text); }
.btn-secondary:hover { background: rgba(120,120,128,0.18); }
.btn-danger { background: rgba(255,59,48,0.1); color: var(--danger); }
.btn-danger:hover { background: rgba(255,59,48,0.16); }
.btn-success { background: rgba(52,199,89,0.12); color: #248a3d; }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--accent); }

.input-group { margin-bottom: 18px; text-align: left; }
.input-group label {
  display: block; font-size: 13px; color: var(--text-secondary);
  margin-bottom: 6px; font-weight: 500;
}
.input, select.input, textarea.input {
  width: 100%; padding: 13px 16px;
  font-size: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(118,118,128,0.08);
  color: var(--text);
  outline: none;
  transition: background .18s var(--ease), box-shadow .18s var(--ease);
  -webkit-appearance: none;
}
.input:focus, select.input:focus, textarea.input:focus {
  background: rgba(118,118,128,0.04);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea.input { resize: vertical; min-height: 90px; font-family: inherit; }
.input-row { display: flex; gap: 10px; }
.input-row .input-group { flex: 1; }

.checkbox-row { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--text-secondary); margin: 14px 0; text-align: left; }
.checkbox-row input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; }
.checkbox-row a { color: var(--accent); font-weight: 500; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 100px;
  font-size: 12px; font-weight: 600;
}
.badge-pending { background: rgba(255,159,10,0.14); color: #b26b00; }
.badge-approved { background: rgba(52,199,89,0.14); color: #248a3d; }
.badge-rejected { background: rgba(255,59,48,0.12); color: var(--danger); }
.badge-disabled { background: rgba(120,120,128,0.14); color: var(--text-secondary); }

.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%) translateY(-30px);
  background: rgba(28,28,30,0.9); color: #fff; padding: 12px 22px; border-radius: 100px;
  font-size: 14px; z-index: 9999; opacity: 0; pointer-events: none;
  transition: all .35s var(--ease);
  backdrop-filter: blur(10px);
  max-width: 86vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,0.4); border-top-color: #fff;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.fade-in { animation: fadeIn .45s var(--ease); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-tertiary); }
.empty-state .icon { font-size: 40px; margin-bottom: 10px; }

/* ===================== 登录 / 注册 ===================== */

.auth-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 400px;
  padding: 40px 32px;
  text-align: center;
}
.auth-logo {
  width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 18px;
  background: linear-gradient(145deg, #34c759, #0a84ff);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; color: #fff; font-weight: 700;
  box-shadow: 0 10px 24px rgba(10,132,255,0.28);
}
.auth-title { font-size: 22px; font-weight: 700; margin: 0 0 4px; }
.auth-subtitle { font-size: 14px; color: var(--text-secondary); margin: 0 0 28px; }
.auth-switch { margin-top: 20px; font-size: 14px; color: var(--text-secondary); }
.auth-switch a { color: var(--accent); font-weight: 600; }
.phone-row { display: flex; gap: 8px; }
.phone-row select.input { flex: 0 0 90px; }

/* 协议弹窗 */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.35);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  z-index: 1000; opacity: 0; pointer-events: none; transition: opacity .3s var(--ease);
  backdrop-filter: blur(4px);
}
.modal-overlay.show { opacity: 1; pointer-events: auto; }
.modal-box {
  width: 100%; max-width: 560px; max-height: 82vh; display: flex; flex-direction: column;
  background: var(--glass-strong); backdrop-filter: blur(30px) saturate(180%);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-strong);
  transform: scale(0.92) translateY(10px); transition: transform .3s var(--ease);
  overflow: hidden;
}
.modal-overlay.show .modal-box { transform: scale(1) translateY(0); }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { margin: 0; font-size: 17px; }
.modal-close { width: 30px; height: 30px; border-radius: 50%; background: rgba(120,120,128,0.14); border: none; cursor: pointer; font-size: 15px; color: var(--text-secondary); }
.modal-body { padding: 20px 24px; overflow-y: auto; font-size: 14px; line-height: 1.9; color: var(--text-secondary); white-space: pre-wrap; }
.modal-body h4 { color: var(--text); margin: 18px 0 6px; font-size: 15px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); }

/* ===================== 应用外壳（登录后） ===================== */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px; flex-shrink: 0; padding: 24px 16px; display: flex; flex-direction: column;
  gap: 4px; position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 8px 12px 24px; }
.sidebar-brand .logo { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(145deg,#34c759,#0a84ff); flex-shrink:0; }
.sidebar-brand .name { font-weight: 700; font-size: 15px; line-height: 1.3; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 14.5px; font-weight: 500; cursor: pointer;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.nav-item .emoji { font-size: 17px; width: 20px; text-align: center; }
.nav-item:hover { background: rgba(120,120,128,0.08); color: var(--text); }
.nav-item.active { background: var(--accent); color: #fff; box-shadow: 0 6px 16px rgba(10,132,255,0.28); }
.sidebar-footer { margin-top: auto; padding: 10px 12px; }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(145deg,#ffb703,#fb8500); display:flex;align-items:center;justify-content:center;color:#fff;font-weight:700; flex-shrink:0; }
.sidebar-user .info { min-width: 0; }
.sidebar-user .info .n { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .info .p { font-size: 12px; color: var(--text-tertiary); }

.main {
  flex: 1; min-width: 0; padding: 28px 32px 100px;
}
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.topbar h1 { font-size: 26px; font-weight: 700; margin: 0; letter-spacing: -0.02em; }
.topbar .actions { display: flex; gap: 10px; }

.card {
  padding: 22px; margin-bottom: 18px;
}
.card-title { font-size: 16px; font-weight: 700; margin: 0 0 14px; }

.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card { padding: 18px 20px; }
.stat-card .label { font-size: 12.5px; color: var(--text-secondary); margin-bottom: 6px; }
.stat-card .value { font-size: 26px; font-weight: 700; }

/* 表格 */
.table-wrap { overflow-x: auto; border-radius: var(--radius-md); }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 640px; }
table.data-table th {
  text-align: left; padding: 12px 14px; color: var(--text-secondary); font-weight: 600;
  border-bottom: 1px solid var(--border); white-space: nowrap; font-size: 12.5px;
}
table.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tr { transition: background .15s var(--ease); }
table.data-table tbody tr:hover { background: rgba(120,120,128,0.05); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.toolbar .input { max-width: 260px; }
.spacer { flex: 1; }

.member-card {
  border-radius: var(--radius-lg); padding: 22px; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(135deg, #0a84ff 0%, #5e5ce6 100%);
  margin-bottom: 16px; box-shadow: 0 14px 30px rgba(10,132,255,0.25);
}
.member-card::after {
  content: ""; position: absolute; width: 220px; height: 220px; border-radius: 50%;
  background: rgba(255,255,255,0.12); top: -80px; right: -60px;
}
.member-card .name { font-size: 17px; font-weight: 700; margin-bottom: 4px; position:relative; }
.member-card .sub { font-size: 12.5px; opacity: 0.85; margin-bottom: 18px; position:relative; }
.member-card .stats { display: flex; gap: 26px; position: relative; }
.member-card .stats .item .v { font-size: 20px; font-weight: 700; }
.member-card .stats .item .l { font-size: 11.5px; opacity: 0.8; }

.announcement-item { padding: 16px 18px; border-radius: var(--radius-md); margin-bottom: 12px; background: rgba(255,255,255,0.55); border: 1px solid var(--border); }
.announcement-item .title { font-weight: 700; font-size: 14.5px; margin-bottom: 4px; }
.announcement-item .meta { font-size: 12px; color: var(--text-tertiary); margin-bottom: 8px; }
.announcement-item .content { font-size: 13.5px; color: var(--text-secondary); line-height: 1.7; white-space: pre-wrap; }
.announcement-item .type-tag { font-size: 11px; padding: 2px 8px; border-radius: 100px; background: var(--accent-soft); color: var(--accent); margin-left: 6px; }

/* 移动端底部导航 */
.tabbar {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 500;
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  background: var(--glass-strong); backdrop-filter: blur(24px) saturate(180%);
  border-top: 1px solid var(--border);
}
.tabbar-inner { display: flex; justify-content: space-around; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.tabbar-inner::-webkit-scrollbar { display: none; }
.tab-item { flex-shrink: 0; }
.tab-item { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--text-tertiary); font-size: 10.5px; padding: 4px 10px; border-radius: 12px; transition: color .18s var(--ease); }
.tab-item .emoji { font-size: 20px; }
.tab-item.active { color: var(--accent); }

.mobile-topbar { display: none; }

/* Modal (通用表单弹窗) */
.form-modal .modal-body { max-height: 62vh; }
.modal-footer-row { display: flex; gap: 10px; justify-content: flex-end; }

/* 开关 */
.switch { position: relative; width: 46px; height: 28px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: #e5e5ea; border-radius: 100px; cursor: pointer; transition: background .2s var(--ease); }
.switch .slider::before { content: ""; position: absolute; width: 24px; height: 24px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: transform .2s var(--ease); box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.switch input:checked + .slider { background: var(--success); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* ===================== 响应式 ===================== */

@media (max-width: 980px) {
  .sidebar { width: 210px; }
  .main { padding: 24px 20px 100px; }
}

@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .sidebar { display: none; }
  .tabbar { display: block; }
  .mobile-topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 18px 8px; position: sticky; top: 0; z-index: 400;
    background: rgba(244,244,247,0.85); backdrop-filter: blur(20px);
  }
  .mobile-topbar .title { font-size: 20px; font-weight: 700; }
  .main { padding: 8px 16px 90px; }
  .topbar h1 { font-size: 21px; }
  .grid-stats { grid-template-columns: repeat(2, 1fr); }
  .auth-card { padding: 32px 22px; }
  table.data-table { min-width: 560px; }
}

@media (min-width: 761px) {
  .mobile-topbar { display: none !important; }
}
