/* 会员管理系统 demo —— 移动优先样式 */

:root {
  --blue: #2d6cdf;
  --blue-dark: #2255b5;
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #1c2230;
  --muted: #7a8399;
  --line: #e3e7ef;
  --danger: #d93b3b;
  --radius: 14px;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

.hidden { display: none !important; }

/* ---------------- 通用控件 ---------------- */
.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 16px;
  min-height: 44px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, opacity .15s;
}
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:active { background: var(--blue-dark); }
.btn.ghost { background: #fff; color: var(--muted); border-color: var(--line); }
.btn.ghost:active { background: #eef1f7; }
.btn.block { width: 100%; display: block; }
.btn.danger { background: #fff; color: var(--danger); border-color: #f3d3d3; }

.testing { opacity: .6; pointer-events: none; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field .req { color: var(--danger); }

input[type="text"], input[type="password"], input[type="tel"],
input[type="date"], input[type="search"], select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 12px 14px;
  font-size: 16px;      /* ≥16px 防 iOS 聚焦缩放 */
  min-height: 46px;
  color: var(--text);
  appearance: none;
}
input:focus, select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(45,108,223,.12); }

.error { color: var(--danger); font-size: 14px; margin: 8px 0 0; min-height: 20px; }
.hint { color: var(--muted); font-size: 12px; margin: 4px 0 0; }

/* ---------------- 登录 ---------------- */
.view { min-height: 100vh; }
#login-view {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 18px 60px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px 22px 24px;
  box-shadow: 0 10px 30px rgba(28,34,48,.08);
}
.login-card h1 { font-size: 22px; margin: 0 0 4px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin: 0 0 22px; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px;
  padding-top: calc(12px + env(safe-area-inset-top));
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.topbar .title { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.badge {
  background: #eaf0fd; color: var(--blue);
  font-size: 12px; font-weight: 700;
  border-radius: 999px; padding: 2px 9px;
}
.topbar-actions { display: flex; gap: 8px; }
.topbar-actions .btn { padding: 8px 12px; min-height: 38px; font-size: 14px; }

.searchbar { padding: 12px 14px 4px; }

/* ---------------- 列表 ---------------- */
.list { padding: 8px 14px 90px; display: grid; gap: 10px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: 0 2px 8px rgba(28,34,48,.05);
}
.card-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.card-name { font-size: 17px; font-weight: 700; }
.card-gender { font-size: 12px; color: var(--muted); }
.card-rows { display: grid; gap: 4px; font-size: 14px; }
.card-row { display: flex; gap: 10px; }
.card-row .k { color: var(--muted); flex: 0 0 62px; }
.card-row .v { flex: 1; word-break: break-all; }
.card-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.card-actions .btn { padding: 7px 14px; min-height: 36px; font-size: 14px; }

.empty { text-align: center; color: var(--muted); padding: 60px 20px; font-size: 14px; }

/* ---------------- 弹层 ---------------- */
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(20,25,38,.45);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0;
}
.modal-card {
  width: 100%;
  max-width: 520px;
  background: #fff;
  border-radius: 18px 18px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  max-height: 92vh;
  overflow-y: auto;
}
.modal-card h2 { font-size: 18px; margin: 0 0 16px; }
.modal-actions { display: flex; gap: 10px; margin-top: 6px; }
.modal-actions .btn { flex: 1; }

/* ---------------- 宽屏（桌面） ---------------- */
@media (min-width: 760px) {
  .list { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); max-width: 1080px; margin: 0 auto; }
  .topbar, .searchbar { padding-left: 28px; padding-right: 28px; }
  .modal { align-items: center; }
  .modal-card { border-radius: 18px; }
}
