/* 虚拟卡网 — 明亮专业风格样式表
   设计原则：
   1. 白底 + 深色文字，清楚明亮，长辈客户也能一眼看懂
   2. 只用一套色板与间距，任何新页面直接复用，不各写一套
   3. 表单元素必须有清楚的聚焦态与错误态（钱的操作不能靠猜）
   4. 手机优先：375px 宽也能正常使用
*/

:root {
  --bg: #f5f7fb;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #eef2f8;
  --border: rgba(15, 23, 42, 0.10);
  --border-strong: rgba(15, 23, 42, 0.20);

  --text: #0f172a;
  --text-muted: #55637a;
  --text-dim: #8592a8;

  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.10);
  --success: #059669;
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.07);
  --warning: #d97706;

  --radius: 14px;
  --radius-sm: 10px;
  --gap: 18px;
  --shadow: 0 6px 20px rgba(15, 23, 42, 0.06);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(900px 420px at 50% -220px, rgba(37, 99, 235, 0.10), transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 顶部导航 ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: linear-gradient(160deg, #1e293b, #0f172a);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .4px;
  color: #f8fafc;
}
.nav-links {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-links a, .nav-links button {
  color: var(--text-muted);
  font-size: 14px;
  padding: 7px 12px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: none;
  cursor: pointer;
  font-family: inherit;
}
.nav-links a:hover, .nav-links button:hover {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--border);
  text-decoration: none;
}

/* ---------- 布局 ---------- */
.main { flex: 1; }
.container { max-width: 1080px; margin: 0 auto; padding: 40px 20px 64px; }
.container--narrow { max-width: 460px; }

.page-head { margin-bottom: 24px; }
h1 { font-size: 26px; line-height: 1.3; margin: 0 0 8px; letter-spacing: -0.01em; }
h2 { font-size: 17px; margin: 0 0 12px; }
.muted { color: var(--text-muted); font-size: 14px; }
.dim { color: var(--text-dim); font-size: 13px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: var(--gap); }
.card--flat { box-shadow: none; background: var(--surface-2); }

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.field > label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 7px;
}
.field .hint { font-size: 12px; color: var(--text-dim); margin-top: 6px; }

input[type="text"], input[type="email"], input[type="password"] {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input::placeholder { color: var(--text-dim); }
input:hover { border-color: #94a3b8; }
input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background .15s ease, transform .06s ease, opacity .15s ease;
}
.btn:hover { background: var(--accent-hover); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn--ghost {
  background: #fff;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn--ghost:hover { background: var(--surface-2); }
.btn--inline { width: auto; }

/* ---------- 提示 ---------- */
.alert {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 14px;
  margin-bottom: 18px;
  border: 1px solid transparent;
}
.alert--error { background: var(--danger-soft); border-color: rgba(220,38,38,.25); color: #991b1b; }
.alert--ok { background: rgba(5,150,105,.08); border-color: rgba(5,150,105,.25); color: #065f46; }
.alert--info { background: var(--accent-soft); border-color: rgba(37,99,235,.22); color: #1e40af; }

/* ---------- 首页 hero ---------- */
.hero { padding: 16px 0 6px; }
.hero h1 { font-size: 34px; }
.hero p { color: var(--text-muted); max-width: 620px; font-size: 16px; }

.grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.feature {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.feature h3 { margin: 0 0 6px; font-size: 15px; }
.feature p { margin: 0; color: var(--text-muted); font-size: 14px; }

/* ---------- 数据面板（预留） ---------- */
.stat-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.stat-label { font-size: 12px; color: var(--text-muted); letter-spacing: .02em; }
.stat-value { font-size: 24px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat-value--empty { color: var(--text-dim); font-size: 15px; font-weight: 500; }
.stat-note { font-size: 12px; color: var(--text-dim); margin-top: 6px; }

/* ---------- 状态徽标 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  background: #fff;
}
.badge--ok { color: #065f46; border-color: rgba(5,150,105,.3); background: rgba(5,150,105,.08); }
.badge--warn { color: #92400e; border-color: rgba(217,119,6,.3); background: rgba(217,119,6,.08); }

/* ---------- 页脚 ---------- */
.footer {
  border-top: 1px solid var(--border);
  padding: 22px 20px;
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
  background: rgba(255,255,255,.6);
}
.footer .dot { opacity: .4; margin: 0 8px; }

/* ---------- 小工具 ---------- */
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stack > * + * { margin-top: 14px; }
.sep { height: 1px; background: var(--border); margin: 22px 0; }
.center { text-align: center; }

@media (max-width: 560px) {
  .container { padding: 26px 16px 48px; }
  .hero h1 { font-size: 27px; }
  .card { padding: 20px 16px; }
  .nav-inner { padding: 12px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- 标签页（登录方式切换） ---------- */
.tabs {
  display: flex;
  gap: 6px;
  background: var(--surface-2);
  padding: 5px;
  border-radius: 12px;
  margin-bottom: 20px;
}
.tab {
  flex: 1;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.tab:hover { color: var(--text); }
.tab.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tab-panel[hidden] { display: none; }

/* ---------- 宽版容器（多区块的账户页用，桌面端不再像手机） ---------- */
.container--wide { max-width: 880px; }

/* 多个安全区块并排：宽屏两列，窄屏自动一列 */
.section-grid {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  align-items: start;
}

/* 区块小标题带一条分隔线，视觉上把"账户状态/安全设置"分开 */
.section-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* 表格在窄屏可以横向滚动，而不是把页面撑破 */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap table { min-width: 420px; }

/* 表格里的行更紧凑一点 */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-align: left; color: var(--text-muted); font-weight: 500; padding: 8px 6px; }
.data-table td { padding: 10px 6px; border-top: 1px solid var(--border); }
.data-table td.num { font-variant-numeric: tabular-nums; }

/* 表单在宽版里不要把按钮拉满整行 */
.card .btn--inline { width: auto; min-width: 140px; }

/* ---------- 密码显示/隐藏 ---------- */
.password-wrap { position: relative; }
.password-wrap input[type="password"],
.password-wrap input[type="text"] { padding-right: 62px; }
.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  padding: 6px 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
.password-toggle:hover { color: var(--text); background: var(--surface-2); }
.password-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- 个人信息页专用排版 ---------- */
.identity {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.avatar {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: linear-gradient(160deg, #1e293b, #0f172a);
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: .5px;
}
.identity-text h1 { margin: 0; font-size: 22px; }
.identity-text .muted { margin: 2px 0 0; font-size: 13px; }
.identity-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }

/* 概览卡片：更紧凑，数字更突出 */
.stat--compact { padding: 16px 18px; }
.stat--compact .stat-value { font-size: 22px; }
.stat--compact .stat-value.small { font-size: 15px; font-weight: 600; }

/* 两列布局：桌面固定两列，手机一列（比 auto-fit 更可控） */
.two-col { display: grid; gap: var(--gap); grid-template-columns: 1fr 1fr; align-items: start; }
@media (max-width: 720px) { .two-col { grid-template-columns: 1fr; } }

/* 卡片标题统一：标题 + 右侧状态 */
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.card-head h2 { margin: 0; font-size: 15px; font-weight: 700; }

/* 表单在卡片里更紧凑 */
.card form .field:last-of-type { margin-bottom: 14px; }

/* ---------- 可折叠区块（默认收起，点击展开） ---------- */
.fold > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  min-width: 140px;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: background .15s ease;
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after {
  content: "▾";
  font-size: 12px;
  opacity: .55;
  transition: transform .15s ease;
}
.fold[open] > summary::after { transform: rotate(180deg); }
.fold > summary:hover { background: var(--surface-2); }
.fold > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fold[open] > summary { margin-bottom: 16px; }
.fold .fold-body { padding-top: 4px; }
