:root {
  --blue: #2f7dd1;
  --blue-dark: #1f5da0;
  --bg: #eef3f9;
  --card: #ffffff;
  --text: #1f2d3d;
  --muted: #71808f;
  --line: #e3e9f0;
  --green: #1fa35a;
  --red: #e5484d;
  --shadow: 0 1px 3px rgba(31, 45, 61, 0.08);
  --radius: 12px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}

.hidden { display: none !important; }

/* ===== 按钮 ===== */
.btn {
  display: inline-block;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font-size: 16px;
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:active { background: var(--blue-dark); }
.btn-block { display: block; width: 100%; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-text { border: none; background: none; color: var(--muted); font-size: 15px; cursor: pointer; padding: 8px; }
.btn-sm { padding: 6px 12px; font-size: 14px; border-radius: 8px; }
.btn-danger { color: var(--red); border-color: #f3c1c3; }

/* ===== 顶栏 ===== */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  background: var(--blue); color: #fff;
  padding: 12px 14px; min-height: 52px;
}
.topbar-title { flex: 1; font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-back { border: none; background: none; color: #fff; font-size: 17px; padding: 4px 6px; cursor: pointer; }
.topbar .btn-text { color: #fff; }

/* ===== 视图 ===== */
.view { max-width: 720px; margin: 0 auto; padding: 14px; }
.view > * + * { margin-top: 12px; }

/* ===== 登录页 ===== */
.auth-body { background: linear-gradient(160deg, #dbeafe, #f3f7fc); min-height: 100vh; }
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: 18px; padding: 26px 22px; box-shadow: 0 10px 30px rgba(31, 45, 61, 0.1); }
.auth-title { margin: 0; font-size: 24px; text-align: center; color: var(--blue-dark); }
.auth-sub { margin: 6px 0 18px; text-align: center; color: var(--muted); font-size: 14px; }
.auth-form label { display: block; margin: 14px 0 6px; font-size: 14px; color: var(--text); }
.auth-form input {
  width: 100%; padding: 12px 14px; font-size: 16px;
  border: 1px solid var(--line); border-radius: 10px; background: #fbfcfe;
}
.auth-form input:focus { outline: none; border-color: var(--blue); }
.auth-form .btn { margin-top: 20px; }
.hint { color: var(--muted); font-size: 12px; }
.form-msg { color: var(--red); font-size: 14px; min-height: 20px; margin: 6px 0 0; text-align: center; }

/* ===== 页签 ===== */
.tabs { display: flex; background: #fff; border-radius: var(--radius); padding: 4px; box-shadow: var(--shadow); }
.tab {
  flex: 1; padding: 10px 6px; border: none; background: none;
  color: var(--muted); font-size: 15px; cursor: pointer; border-radius: 9px;
}
.tab.active { background: var(--blue); color: #fff; font-weight: 600; }
.tabs-fixed { border-radius: 0; margin: 0; box-shadow: none; border-bottom: 1px solid var(--line); position: sticky; top: 52px; z-index: 9; }

/* ===== 卡片 / 列表 ===== */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 12px; }
.list { display: flex; flex-direction: column; gap: 12px; }
.actions { display: flex; gap: 10px; }
.actions .btn { flex: 1; }

.proj-card { cursor: pointer; }
.proj-name { font-size: 18px; font-weight: 600; margin: 0 0 4px; }
.proj-meta { color: var(--muted); font-size: 14px; display: flex; gap: 14px; flex-wrap: wrap; }
.proj-meta span { display: inline-flex; align-items: center; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 12px; }
.badge-admin { background: #e8f1fb; color: var(--blue-dark); }
.badge-member { background: #f0f2f5; color: var(--muted); }
.badge-virtual { background: #fdf3e7; color: #b26a00; }

/* ===== 详情头部 ===== */
.detail-head { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.detail-head h2 { margin: 0 0 6px; font-size: 20px; }
.detail-head .meta { color: var(--muted); font-size: 14px; }
.invite { margin-top: 10px; font-size: 15px; }
.invite code { background: #eef3f9; padding: 4px 10px; border-radius: 6px; font-size: 16px; letter-spacing: 1px; color: var(--blue-dark); font-weight: 700; }

/* ===== 统计卡 ===== */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); text-align: center; }
.stat-num { font-size: 24px; font-weight: 700; color: var(--blue-dark); }
.stat-label { font-size: 13px; color: var(--muted); margin-top: 2px; }
.stat.highlight { background: var(--blue); border-color: var(--blue); }
.stat.highlight .stat-num, .stat.highlight .stat-label { color: #fff; }

.chart-box { position: relative; height: 260px; width: 100%; padding: 8px 4px; }

/* ===== 表单 ===== */
.field { margin-bottom: 12px; }
.field label { display: block; margin-bottom: 6px; font-size: 14px; color: var(--text); }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; font-size: 16px;
  border: 1px solid var(--line); border-radius: 10px; background: #fbfcfe;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--blue); }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }

.pane { padding: 14px 0; }
.pane .card + .card { margin-top: 12px; }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 8px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; background: #f7f9fc; }
td.num, th.num { text-align: right; }
tr.me td { background: #eef6ff; }
tr.total td { font-weight: 700; background: #f7f9fc; }

/* ===== 成员行 ===== */
.member-row { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.member-row:last-child { border-bottom: none; }
.member-name { flex: 1; font-size: 16px; }
.member-actions { display: flex; gap: 6px; }
.muted { color: var(--muted); font-size: 14px; }
.section-title { font-size: 15px; font-weight: 600; color: var(--muted); margin: 4px 0 8px; }

/* ===== 提示 ===== */
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%);
  background: rgba(31, 45, 61, 0.9); color: #fff; padding: 10px 18px;
  border-radius: 20px; font-size: 14px; max-width: 80vw; z-index: 100;
}
.empty { text-align: center; color: var(--muted); padding: 30px 10px; font-size: 15px; }

/* 费用页"我该交"高亮卡 */
.my-fee { border: 1px solid var(--green); }
.my-fee .stat-num { color: var(--green); font-size: 30px; }
.my-fee .section-title { color: var(--green); font-weight: 700; }

/* 桌面宽屏微调 */
@media (min-width: 720px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .field-row { max-width: 460px; }
}