/* ============ 校园卡报单中心 · 基础样式 ============ */
:root {
  --brand: #2f6bff;
  --brand-dark: #1e4fd8;
  --ok: #16a34a;
  --warn: #d97706;
  --err: #dc2626;
  --text: #16202f;
  --text-2: #5b6b82;
  --text-3: #93a2b8;
  --line: #e4eaf2;
  --bg: #f4f7fb;
  --card: #ffffff;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(22, 32, 47, .06);
}

* { 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", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .5px; }

a { color: var(--brand); }

/* ---------- 顶部栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 6px rgba(22, 32, 47, .04);
  flex-wrap: wrap;
}
.topbar .brand { font-size: 17px; font-weight: 700; letter-spacing: .3px; }
.topbar .spacer { flex: 1; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px;
  background: #eef3ff; color: var(--brand-dark);
  font-size: 13px; font-weight: 600; cursor: pointer;
  border: none; font-family: inherit;
}
.chip:hover { background: #e2ebff; }
.topbar .who { font-size: 14px; color: var(--text-2); }

/* ---------- 布局 ---------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 18px 16px 60px; }
.wrap-narrow { max-width: 480px; margin: 0 auto; padding: 22px 16px 60px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}
.card-title { font-size: 16px; font-weight: 700; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }
.card-title .sub { font-size: 12px; font-weight: 400; color: var(--text-3); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px;
  border-radius: 9px;
  border: 1px solid transparent;
  font-size: 14px; font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: filter .15s, background .15s;
  white-space: nowrap;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); }
.btn-ghost { background: #fff; color: var(--text-2); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.btn-danger { background: var(--err); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(.93); }
.btn-sm { padding: 5px 11px; font-size: 13px; border-radius: 7px; }
.btn-block { width: 100%; margin-top: 10px; }

/* ---------- 表单 ---------- */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.form-label .req { color: var(--err); margin-left: 2px; }
.form-input, .form-select, textarea.form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.form-input:focus, .form-select:focus, textarea.form-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(47, 107, 255, .12);
}
.form-select { appearance: none; background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235b6b82' d='M6 8.5L2 4.5h8z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.form-hint { font-size: 12px; margin-top: 5px; min-height: 16px; }
.form-hint.error { color: var(--err); }
.form-hint.ok { color: var(--ok); }
.form-error { color: var(--err); font-size: 13px; margin-top: 8px; min-height: 18px; }
.inline-row { display: flex; gap: 8px; }
.inline-row .form-input { flex: 1; }
.inline-row .btn { flex-shrink: 0; }
.form-check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-2); margin-bottom: 12px; }
.form-check input { width: 16px; height: 16px; }

/* ---------- 提示 ---------- */
.alert {
  padding: 11px 13px; border-radius: 9px;
  background: #eff5ff; color: var(--brand-dark);
  font-size: 13.5px; margin-bottom: 14px; line-height: 1.55;
}
.alert-error { background: #fef2f2; color: #b91c1c; }
.alert-warn { background: #fffbeb; color: #92400e; }
.alert-ok { background: #f0fdf4; color: #15803d; }

#toast-box {
  position: fixed; left: 50%; top: 18px; transform: translateX(-50%);
  z-index: 9999; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; width: min(92vw, 420px);
}
.toast {
  background: #fff; color: var(--text);
  border: 1px solid var(--line);
  padding: 10px 18px; border-radius: 10px;
  font-size: 14px; box-shadow: 0 8px 24px rgba(22, 32, 47, .12);
  max-width: 100%; text-align: center;
}
.toast.ok { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.toast.err { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(15, 23, 38, .5);
  display: flex; align-items: center; justify-content: center;
  padding: 16px; overflow-y: auto;
}
.modal {
  background: #fff; border-radius: 14px;
  width: min(520px, 100%);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .22);
  max-height: 88vh; display: flex; flex-direction: column;
  animation: pop .16s ease-out;
}
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }
.modal-title { padding: 16px 18px; font-size: 16px; font-weight: 700; border-bottom: 1px solid var(--line); }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-actions { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- 个人中心 ---------- */
.pc-head { display: flex; align-items: center; gap: 13px; margin-bottom: 16px; }
.pc-avatar {
  width: 50px; height: 50px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #6d9bff);
  color: #fff; font-size: 21px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.pc-name { font-size: 17px; font-weight: 700; }
.pc-role { font-size: 13px; color: var(--text-3); }
.pc-list { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.pc-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 11px 14px; font-size: 14px;
  border-bottom: 1px solid var(--line);
}
.pc-row:last-child { border-bottom: none; }
.pc-row:nth-child(odd) { background: #fafbfd; }
.pc-row span { color: var(--text-3); flex-shrink: 0; }
.pc-row b { font-weight: 600; text-align: right; word-break: break-all; }
.pc-actions { margin-top: 14px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 10px; border: 1px solid var(--line); }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 720px; }
table.data th {
  background: #f7f9fc; color: var(--text-2); font-weight: 600;
  text-align: left; padding: 10px 12px; white-space: nowrap;
  border-bottom: 1px solid var(--line); font-size: 13px;
}
table.data td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: #fafbfd; }
.empty { text-align: center; padding: 34px 12px; color: var(--text-3); font-size: 14px; }

.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge-active { background: #eff6ff; color: #1d4ed8; }
.badge-settled { background: #f0fdf4; color: #15803d; }
.badge-cancelled { background: #f1f5f9; color: #64748b; }
.badge-done { background: #f0fdf4; color: #15803d; }
.badge-unpaid { background: #fffbeb; color: #b45309; }

/* ---------- 可搜索下拉 ---------- */
.cb { position: relative; }
.cb-input {
  width: 100%; padding: 10px 32px 10px 12px;
  border: 1px solid var(--line); border-radius: 9px;
  font-size: 15px; font-family: inherit; background: #fff; color: var(--text);
}
.cb-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47, 107, 255, .12); }
.cb-arrow { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 11px; pointer-events: none; }
.cb-panel {
  display: none; position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 4px);
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(22, 32, 47, .14);
  max-height: 280px; overflow-y: auto;
}
.cb-panel.open { display: block; }
.cb-option { padding: 9px 12px; font-size: 14px; cursor: pointer; border-bottom: 1px solid #f1f5f9; }
.cb-option:last-child { border-bottom: none; }
.cb-option:hover, .cb-option.hl { background: #eef3ff; color: var(--brand-dark); }
.cb-empty { padding: 16px; text-align: center; color: var(--text-3); font-size: 13px; }

/* ---------- 页签 ---------- */
.tabbar { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabbar button {
  padding: 10px 16px; border: none; background: none;
  font-size: 14px; font-weight: 600; color: var(--text-3);
  cursor: pointer; font-family: inherit; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabbar button.active { color: var(--brand); border-bottom-color: var(--brand); }

/* ---------- 统计卡 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 16px;
}
.stat .label { font-size: 12.5px; color: var(--text-3); margin-bottom: 5px; }
.stat .value { font-size: 25px; font-weight: 800; letter-spacing: -.5px; line-height: 1.2; }
.stat .value small { font-size: 13px; font-weight: 600; color: var(--text-3); margin-left: 3px; }

/* ---------- 微信引导（浅色） ---------- */
.wx-mask {
  position: fixed; inset: 0; z-index: 99999;
  background: #f4f7fb; color: var(--text);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 30px; text-align: center;
}
.wx-mask h2 { font-size: 20px; margin: 0 0 12px; color: var(--text); }
.wx-mask p { color: var(--text-2); font-size: 14px; line-height: 1.7; margin: 0 0 8px; max-width: 340px; }
.wx-mask .wx-url {
  background: #fff; border: 1px solid var(--line);
  padding: 12px 14px; border-radius: 10px;
  font-size: 13px; word-break: break-all; margin: 16px 0; max-width: 100%;
  color: var(--text-2);
  font-family: ui-monospace, Consolas, monospace;
}
.wx-mask .btn-ghost { background: #fff; border-color: var(--line); color: var(--text-2); }

/* ---------- 移动端 ---------- */
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .wrap { padding: 14px 12px 60px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; gap: 0; }
  .topbar { padding: 10px 14px; gap: 8px; }
  .topbar .brand { font-size: 15.5px; }
  .card { padding: 15px 14px; }
  .modal { width: 100%; max-height: 92vh; }
  .stat .value { font-size: 22px; }
  .btn { padding: 9px 15px; }
}