/* ==========================================================================
   电子礼簿 — 样式表
   现代灰白蓝应用框架 + 多种仿真纸质账簿主题
   ========================================================================== */

/* ---------- 1. 基础与全局变量 ---------- */
:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;
  --accent: #0ea5e9;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --text: #1e293b;
  --text-2: #64748b;
  --text-3: #94a3b8;
  --border: #e5e9f0;
  --border-strong: #cbd5e1;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05), 0 2px 8px rgba(15, 23, 42, .04);
  --shadow: 0 2px 6px rgba(15, 23, 42, .06), 0 12px 32px rgba(15, 23, 42, .07);
  --shadow-lg: 0 8px 24px rgba(15, 23, 42, .1), 0 24px 64px rgba(15, 23, 42, .12);
  --r-sm: 8px;
  --r: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: 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.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
svg { display: block; }

/* ---------- 2. 应用框架 ---------- */
.shell {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 720px;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
  padding: calc(var(--safe-top) + 12px) 18px 12px;
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar .tb-back {
  width: 36px; height: 36px; flex: 0 0 36px;
  border-radius: 10px;
  display: grid; place-items: center;
  color: var(--text-2);
  background: var(--surface-3);
  transition: .18s;
}
.topbar .tb-back:active { transform: scale(.92); }
.topbar .tb-title { font-size: 16px; font-weight: 650; letter-spacing: .2px; flex: 1; min-width: 0; }
.topbar .tb-title small { display: block; font-size: 11px; font-weight: 400; color: var(--text-3); letter-spacing: .5px; }
.topbar .tb-action { display: flex; gap: 8px; align-items: center; }

.view {
  flex: 1;
  padding: 18px 16px calc(92px + var(--safe-bottom));
  animation: viewIn .28s ease both;
}
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.bottom-nav {
  position: fixed;
  bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 720px;
  z-index: 30;
  background: rgba(255, 255, 255, .95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 8px 8px calc(8px + var(--safe-bottom));
}
.bottom-nav .nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 2px; border-radius: 10px;
  color: var(--text-3); font-size: 11px; font-weight: 500;
  transition: .18s;
}
.bottom-nav .nav-item.active { color: var(--primary); background: var(--primary-soft); }
.bottom-nav .nav-item svg { width: 21px; height: 21px; }

/* 大屏模式隐藏移动端框架 */
body.screen-mode .topbar, body.screen-mode .bottom-nav { display: none; }
body.screen-mode .shell { display: block; max-width: none; height: 100vh; height: 100dvh; background: transparent; }
body.screen-mode .view { padding: 0; max-width: none; animation: none; height: 100%; }
body.screen-mode { background: #0f172a; }

/* ---------- 3. 通用 UI 组件 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  padding: 18px;
}
.card + .card { margin-top: 14px; }
.card-title { font-size: 15px; font-weight: 650; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }
.card-title .icon { color: var(--primary); }
.card-sub { font-size: 12px; color: var(--text-3); font-weight: 400; margin-left: auto; }

.section-label {
  font-size: 11px; font-weight: 700; letter-spacing: 1.2px;
  color: var(--text-3); text-transform: uppercase;
  margin: 22px 2px 10px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; border-radius: 12px;
  font-size: 14px; font-weight: 600;
  background: var(--surface-3); color: var(--text);
  transition: transform .15s, background .18s, box-shadow .18s;
  min-height: 44px;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 14px rgba(37, 99, 235, .28); }
.btn-primary:active { background: var(--primary-dark); }
.btn-block { width: 100%; }
.btn-lg { padding: 16px 22px; font-size: 16px; min-height: 56px; border-radius: 16px; }
.btn-ghost { background: transparent; border: 1px solid var(--border-strong); }
.btn-danger { background: #fef2f2; color: var(--danger); }
.btn-sm { padding: 8px 12px; min-height: 36px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: .5; pointer-events: none; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 7px; }
.field .hint { font-size: 11px; color: var(--text-3); margin-top: 6px; }
.input, .textarea, .select {
  width: 100%; padding: 13px 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px; background: var(--surface);
  font-size: 16px; outline: none; transition: border-color .18s, box-shadow .18s;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.input-xl { font-size: 22px; font-weight: 600; padding: 16px; letter-spacing: 1px; }
.textarea { resize: vertical; min-height: 80px; }
.input-row { display: flex; gap: 10px; }
.input-row .input { flex: 1; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 14px; border-radius: 999px;
  background: var(--surface-3); color: var(--text-2);
  font-size: 13px; font-weight: 600; transition: .18s;
  border: 1.5px solid transparent;
}
.chip:active { transform: scale(.94); }
.chip.active { background: var(--primary-soft); color: var(--primary); border-color: rgba(37, 99, 235, .3); }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 650;
  background: var(--surface-3); color: var(--text-2);
}
.badge.success { background: #f0fdf4; color: var(--success); }
.badge.warning { background: #fffbeb; color: var(--warning); }
.badge.danger { background: #fef2f2; color: var(--danger); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 14px 12px; text-align: center;
}
.stat-box .num { font-size: 22px; font-weight: 750; letter-spacing: -.5px; color: var(--text); }
.stat-box .num.primary { color: var(--primary); }
.stat-box .label { font-size: 11px; color: var(--text-3); margin-top: 2px; }

.empty {
  text-align: center; padding: 48px 16px; color: var(--text-3);
}
.empty svg { width: 48px; height: 48px; margin: 0 auto 14px; color: var(--border-strong); }
.empty p { margin: 0 0 4px; font-size: 14px; }
.empty small { font-size: 12px; }

.list { display: flex; flex-direction: column; gap: 10px; }
.list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px;
}
.list-row .avatar {
  width: 38px; height: 38px; flex: 0 0 38px; border-radius: 11px;
  background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center; font-weight: 700; font-size: 15px;
}
.list-row .info { flex: 1; min-width: 0; }
.list-row .info .name { font-weight: 650; font-size: 14px; }
.list-row .info .meta { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.list-row .amount { font-weight: 700; font-size: 16px; color: var(--text); }
.list-row .row-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center; color: var(--text-3);
  background: var(--surface-3); transition: .18s;
}
.icon-btn:active { transform: scale(.9); }
.icon-btn svg { width: 17px; height: 17px; }

/* ---------- 4. 仿真纸质账簿主题 ---------- */
/* 默认：传统红封 */
[data-theme] {
  --paper-bg: #fdf7e8;
  --paper-line: rgba(158, 58, 46, .20);
  --paper-line-strong: rgba(158, 58, 46, .48);
  --paper-ink: #40241c;
  --paper-muted: #8a6b58;
  --paper-font: "Kaiti SC", "STKaiti", "KaiTi", "楷体", serif;
  --paper-title-font: "STKaiti", "KaiTi", "楷体", serif;
  --cover-bg: linear-gradient(150deg, #9c2424 0%, #6f1212 100%);
  --cover-ink: #f7e3b5;
  --cover-accent: #d9b45c;
  --cover-line: rgba(233, 196, 120, .45);
  --seal-color: #b3261e;
  --paper-shadow: 0 2px 0 #e7dcc0, 0 10px 30px rgba(60, 30, 10, .18);
}
[data-theme="kraft"] {
  --paper-bg: #e9d8b4;
  --paper-line: rgba(101, 71, 38, .26);
  --paper-line-strong: rgba(101, 71, 38, .55);
  --paper-ink: #4a3520;
  --paper-muted: #806344;
  --paper-font: "FangSong", "STFangsong", "仿宋", "Songti SC", serif;
  --paper-title-font: "STKaiti", "KaiTi", "楷体", serif;
  --cover-bg: linear-gradient(150deg, #a5814f 0%, #6f5230 100%);
  --cover-ink: #f5e8cf;
  --cover-accent: #d9c39a;
  --cover-line: rgba(240, 222, 184, .4);
  --seal-color: #8c3b23;
  --paper-shadow: 0 2px 0 #d3bd93, 0 10px 30px rgba(70, 45, 15, .2);
}
[data-theme="rice"] {
  --paper-bg: #fbf9f1;
  --paper-line: rgba(70, 70, 60, .15);
  --paper-line-strong: rgba(70, 70, 60, .38);
  --paper-ink: #33332d;
  --paper-muted: #8a8a7c;
  --paper-font: "Kaiti SC", "STKaiti", "KaiTi", "楷体", serif;
  --paper-title-font: "STKaiti", "KaiTi", "楷体", serif;
  --cover-bg: linear-gradient(150deg, #f2eee1 0%, #e5dfcd 100%);
  --cover-ink: #3a3a32;
  --cover-accent: #9a8f70;
  --cover-line: rgba(120, 110, 85, .35);
  --seal-color: #a33a33;
  --paper-shadow: 0 2px 0 #e9e4d3, 0 10px 30px rgba(60, 55, 35, .12);
}
[data-theme="blue"] {
  --paper-bg: #f7f9fc;
  --paper-line: rgba(44, 87, 148, .20);
  --paper-line-strong: rgba(44, 87, 148, .48);
  --paper-ink: #203457;
  --paper-muted: #7186a5;
  --paper-font: "Songti SC", "STSong", "SimSun", "宋体", serif;
  --paper-title-font: "STKaiti", "KaiTi", "楷体", serif;
  --cover-bg: linear-gradient(150deg, #34558c 0%, #1d3660 100%);
  --cover-ink: #e8f0fb;
  --cover-accent: #9dbbe4;
  --cover-line: rgba(190, 214, 245, .42);
  --seal-color: #b03a3a;
  --paper-shadow: 0 2px 0 #dfe7f2, 0 10px 30px rgba(25, 50, 90, .16);
}
[data-theme="modern"] {
  --paper-bg: #ffffff;
  --paper-line: rgba(148, 163, 184, .22);
  --paper-line-strong: rgba(100, 116, 139, .42);
  --paper-ink: #1e293b;
  --paper-muted: #94a3b8;
  --paper-font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  --paper-title-font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  --cover-bg: linear-gradient(150deg, #eef2f7 0%, #dce4ef 100%);
  --cover-ink: #1e293b;
  --cover-accent: #64748b;
  --cover-line: rgba(100, 116, 139, .25);
  --seal-color: #dc2626;
  --paper-shadow: 0 2px 0 #e8edf4, 0 10px 30px rgba(30, 41, 59, .1);
}

.paper {
  background: var(--paper-bg);
  color: var(--paper-ink);
  font-family: var(--paper-font);
  border-radius: 6px;
  box-shadow: var(--paper-shadow);
  position: relative;
  overflow: hidden;
}
.paper::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(0,0,0,.014) 3px 4px),
    repeating-linear-gradient(90deg, transparent 0 41px, rgba(0,0,0,.012) 41px 42px);
  mix-blend-mode: multiply;
  opacity: .55;
}
.paper-grid {
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(var(--row-h, 52px) - 1px),
    var(--paper-line) calc(var(--row-h, 52px) - 1px),
    var(--paper-line) var(--row-h, 52px)
  );
}
.paper-grid-v {
  background-image:
    repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--row-h, 52px) - 1px), var(--paper-line) calc(var(--row-h, 52px) - 1px), var(--paper-line) var(--row-h, 52px)),
    linear-gradient(to right, transparent 0, transparent 28%, var(--paper-line) 28%, var(--paper-line) calc(28% + 1px), transparent calc(28% + 1px)),
    linear-gradient(to right, transparent 0, transparent 62%, var(--paper-line) 62%, var(--paper-line) calc(62% + 1px), transparent calc(62% + 1px));
}

.cover {
  background: var(--cover-bg);
  color: var(--cover-ink);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 36px rgba(0, 0, 0, .22);
  padding: 30px 24px;
  text-align: center;
}
.cover::before, .cover::after {
  content: ""; position: absolute; left: 14px; right: 14px; height: 1px;
  background: var(--cover-line);
}
.cover::before { top: 14px; }
.cover::after { bottom: 14px; }
.cover .cover-border {
  position: absolute; inset: 20px; border: 1px solid var(--cover-line); border-radius: 3px; pointer-events: none;
}
.cover .cover-label { font-size: 12px; letter-spacing: 6px; opacity: .82; margin-bottom: 16px; }
.cover .cover-title {
  font-family: var(--paper-title-font);
  font-size: 30px; font-weight: 700; letter-spacing: 3px; line-height: 1.35;
  text-shadow: 0 2px 4px rgba(0,0,0,.18);
  word-break: break-all;
}
.cover .cover-rule { width: 54px; height: 2px; background: var(--cover-accent); margin: 18px auto; border-radius: 2px; }
.cover .cover-meta { font-size: 13px; line-height: 2; opacity: .9; font-family: var(--paper-font); }
.cover .cover-seal {
  position: absolute; right: 26px; bottom: 26px;
  width: 58px; height: 58px; border: 2px solid var(--seal-color);
  color: var(--seal-color); border-radius: 6px;
  display: grid; place-items: center; transform: rotate(-12deg);
  font-family: var(--paper-title-font); font-size: 13px; font-weight: 700; line-height: 1.2;
  text-align: center; opacity: .9; padding: 4px;
}
.cover-frame { padding: 8px 12px; }

.theme-preview {
  height: 84px; border-radius: 9px; position: relative; overflow: hidden;
  border: 1px solid var(--border);
  background: var(--paper-bg);
  color: var(--paper-ink);
  font-family: var(--paper-font);
}
.theme-preview .tp-cover {
  position: absolute; inset: 0;
  background: var(--cover-bg); color: var(--cover-ink);
  display: grid; place-items: center; font-family: var(--paper-title-font);
  font-size: 17px; letter-spacing: 2px;
}
.theme-preview .tp-lines {
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 19px, var(--paper-line) 19px, var(--paper-line) 20px);
}
.theme-preview .tp-name {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  font-size: 15px; font-weight: 700; letter-spacing: 1px;
}

/* ---------- 5. 首页 ---------- */
.hero {
  background: linear-gradient(145deg, #ffffff 0%, #f0f5ff 100%);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 22px 20px; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -40px; top: -40px;
  width: 170px; height: 170px; border-radius: 50%;
  background: radial-gradient(circle, rgba(37,99,235,.10), transparent 70%);
}
.hero-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; color: var(--primary); letter-spacing: 1px; }
.hero-badge svg { width: 15px; height: 15px; }
.hero h1 { font-size: 25px; margin: 10px 0 6px; letter-spacing: -.5px; }
.hero p { margin: 0 0 20px; color: var(--text-2); font-size: 13px; line-height: 1.7; max-width: 280px; }
.hero .btn { position: relative; z-index: 1; }

.feature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.feature {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 14px; box-shadow: var(--shadow-sm);
}
.feature .fi { width: 32px; height: 32px; border-radius: 9px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; margin-bottom: 10px; }
.feature .fi svg { width: 17px; height: 17px; }
.feature h3 { font-size: 13px; margin: 0 0 3px; }
.feature p { font-size: 11px; color: var(--text-3); margin: 0; line-height: 1.5; }

.book-card {
  display: flex; align-items: center; gap: 13px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 14px; box-shadow: var(--shadow-sm);
  transition: .18s;
}
.book-card:active { transform: scale(.985); }
.book-card .bc-thumb {
  width: 46px; height: 56px; flex: 0 0 46px; border-radius: 5px;
  background: var(--cover-bg); position: relative; overflow: hidden;
  box-shadow: 0 3px 8px rgba(0,0,0,.15);
}
.book-card .bc-thumb::after {
  content: ""; position: absolute; inset: 5px; border: 1px solid var(--cover-line);
}
.book-card .bc-info { flex: 1; min-width: 0; }
.book-card .bc-info h4 { font-size: 14px; margin: 0 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.book-card .bc-info p { margin: 0; font-size: 11px; color: var(--text-3); }
.book-card .bc-arrow { color: var(--text-3); }
.book-card .bc-arrow svg { width: 18px; height: 18px; }

/* ---------- 6. 账簿页 ---------- */
.book-header {
  border-radius: var(--r-lg);
  padding: 18px; margin-bottom: 14px;
  position: relative; overflow: hidden;
  background: var(--cover-bg); color: var(--cover-ink);
  box-shadow: 0 8px 24px rgba(0,0,0,.14);
}
.book-header::before { content: ""; position: absolute; inset: 8px; border: 1px solid var(--cover-line); border-radius: 12px; pointer-events: none; }
.book-header .bh-top { display: flex; align-items: flex-start; gap: 10px; }
.book-header h2 { font-family: var(--paper-title-font); font-size: 21px; margin: 0 0 6px; letter-spacing: 1px; line-height: 1.35; }
.book-header .bh-meta { font-size: 11px; opacity: .85; line-height: 1.7; }
.book-header .bh-code {
  margin-left: auto; background: rgba(255,255,255,.14); border: 1px solid var(--cover-line);
  padding: 6px 10px; border-radius: 9px; font-size: 12px; font-weight: 700; letter-spacing: 1.5px; white-space: nowrap;
}
.book-header .bh-stats { display: flex; gap: 24px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--cover-line); position: relative; }
.book-header .bh-stat .n { font-size: 20px; font-weight: 750; }
.book-header .bh-stat .l { font-size: 10px; opacity: .8; letter-spacing: 1px; }

.tabs {
  display: flex; gap: 4px; background: var(--surface-3);
  padding: 4px; border-radius: 12px; margin-bottom: 16px;
}
.tabs .tab {
  flex: 1; text-align: center; padding: 9px 4px; border-radius: 9px;
  font-size: 13px; font-weight: 600; color: var(--text-2); transition: .18s;
}
.tabs .tab.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }

.quick-amounts { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.quick-amounts .qa {
  padding: 6px 12px; border-radius: 8px; font-size: 12px; font-weight: 650;
  background: var(--surface-3); color: var(--text-2); transition: .18s;
}
.quick-amounts .qa:active { transform: scale(.92); }
.quick-amounts .qa.active { background: var(--primary); color: #fff; }

.input-amount-wrap { position: relative; }
.input-amount-wrap .yuan { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 18px; font-weight: 600; pointer-events: none; }
.input-amount-wrap .input-xl { padding-right: 48px; }

.sync-strip {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border-radius: 10px; font-size: 11px;
  background: var(--surface-3); color: var(--text-2); margin-bottom: 14px;
}
.sync-strip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex: 0 0 7px; }
.sync-strip.online { background: #f0fdf4; color: var(--success); }
.sync-strip.online .dot { background: var(--success); box-shadow: 0 0 0 3px rgba(22,163,74,.16); }
.sync-strip.offline { background: #fffbeb; color: var(--warning); }
.sync-strip.offline .dot { background: var(--warning); }
.sync-strip .sync-label { font-weight: 650; }
.sync-strip .sync-detail { margin-left: auto; opacity: .8; }

.qr-box { background: #fff; padding: 12px; border-radius: 12px; display: inline-block; box-shadow: var(--shadow-sm); }
.qr-box svg, .qr-box img { width: 100%; height: 100%; display: block; }
.qr-wrap { text-align: center; padding: 8px 0; }
.qr-wrap .qr-title { font-size: 14px; font-weight: 650; margin-bottom: 4px; }
.qr-wrap .qr-desc { font-size: 11px; color: var(--text-3); margin: 10px auto 0; max-width: 230px; line-height: 1.6; }
.qr-wrap .qr-box { width: 180px; height: 180px; }

.share-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.share-grid .qr-wrap .qr-box { width: 100%; aspect-ratio: 1; height: auto; }

/* ---------- 7. 大屏 ---------- */
.screen-root {
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--paper-bg);
  color: var(--paper-ink);
  font-family: var(--paper-font);
  position: relative;
}
.screen-root::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background-image: repeating-linear-gradient(0deg, transparent 0 4px, rgba(0,0,0,.012) 4px 5px);
}
.screen-head {
  flex: 0 0 auto; position: relative; z-index: 1;
  text-align: center; padding: 2.4vh 4vw 1.6vh;
  border-bottom: 2px solid var(--paper-line-strong);
  background: var(--cover-bg); color: var(--cover-ink);
}
.screen-head .sh-label { font-size: clamp(11px, 1.1vw, 15px); letter-spacing: 8px; opacity: .82; }
.screen-head h1 {
  font-family: var(--paper-title-font);
  font-size: clamp(26px, 3.6vw, 54px); font-weight: 700;
  letter-spacing: 5px; margin: 1vh 0 .8vh; line-height: 1.2;
}
.screen-head .sh-sub { font-size: clamp(12px, 1.3vw, 19px); opacity: .9; letter-spacing: 2px; }
.screen-head .sh-line { width: 70px; height: 2px; background: var(--cover-accent); margin: 1.2vh auto 0; }

.screen-body { flex: 1; min-height: 0; position: relative; z-index: 1; display: flex; flex-direction: column; }
.screen-cols {
  display: grid; grid-template-columns: 1fr 1.1fr 1fr;
  flex: 0 0 auto;
  border-bottom: 2px solid var(--paper-line-strong);
  background: color-mix(in srgb, var(--paper-bg) 92%, var(--paper-ink) 8%);
  position: sticky; top: 0; z-index: 3;
}
.screen-cols div {
  text-align: center; padding: 1.1vh 1vw;
  font-size: clamp(13px, 1.4vw, 20px); font-weight: 700; letter-spacing: 4px;
  border-right: 1px solid var(--paper-line);
}
.screen-cols div:last-child { border-right: none; }
.screen-scroll { flex: 1; min-height: 0; overflow: hidden; position: relative; }
.screen-list { will-change: transform; }
.screen-row {
  display: grid; grid-template-columns: 1fr 1.1fr 1fr;
  align-items: center;
  height: clamp(52px, 8.4vh, 96px);
  border-bottom: 1px solid var(--paper-line);
  padding: 0 3vw;
  font-size: clamp(18px, 2.4vw, 34px);
  font-weight: 600;
}
.screen-row:nth-child(even) { background: color-mix(in srgb, var(--paper-ink) 3%, transparent); }
.screen-row .sr-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 8px; }
.screen-row .sr-amount { text-align: center; font-weight: 750; letter-spacing: 1px; }
.screen-row .sr-time { text-align: right; font-size: clamp(11px, 1.2vw, 17px); color: var(--paper-muted); font-weight: 400; }
.screen-row.is-new { animation: rowFlash 1.6s ease; }
@keyframes rowFlash { 0% { background: color-mix(in srgb, var(--cover-accent) 45%, transparent); } 100% { background: transparent; } }
.screen-empty { display: grid; place-items: center; height: 100%; font-size: clamp(14px, 1.6vw, 22px); color: var(--paper-muted); letter-spacing: 3px; }

.screen-foot {
  flex: 0 0 auto; position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: space-between; gap: 3vw;
  padding: 1.4vh 4vw; border-top: 2px solid var(--paper-line-strong);
  background: color-mix(in srgb, var(--paper-bg) 94%, var(--paper-ink) 6%);
}
.screen-total { display: flex; align-items: baseline; gap: 14px; }
.screen-total .st-label { font-size: clamp(12px, 1.3vw, 18px); letter-spacing: 3px; color: var(--paper-muted); }
.screen-total .st-num { font-size: clamp(26px, 3.4vw, 48px); font-weight: 750; letter-spacing: 1px; }
.screen-foot-right { display: flex; align-items: center; gap: 2vw; font-size: clamp(11px, 1.1vw, 16px); color: var(--paper-muted); }
.screen-qr { width: clamp(64px, 8vh, 110px); height: clamp(64px, 8vh, 110px); background: #fff; padding: 5px; border-radius: 4px; }
.screen-qr svg, .screen-qr img { width: 100%; height: 100%; display: block; }
.screen-code { font-weight: 700; letter-spacing: 2px; color: var(--paper-ink); }
.screen-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 9; transition: opacity .5s; }
.screen-flash.on { opacity: .75; transition: opacity .05s; }

/* ---------- 8. 核对页 ---------- */
.verify-wrap { max-width: 480px; margin: 0 auto; }
.verify-intro { text-align: center; padding: 10px 0 20px; }
.verify-intro .vi-icon { width: 52px; height: 52px; border-radius: 16px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; margin: 0 auto 12px; }
.verify-intro .vi-icon svg { width: 26px; height: 26px; }
.verify-intro h1 { font-size: 20px; margin: 0 0 6px; }
.verify-intro p { margin: 0; font-size: 13px; color: var(--text-2); }
.verify-paper { padding: 0; }
.verify-paper .vp-head {
  text-align: center; padding: 20px 18px 16px;
  border-bottom: 2px solid var(--paper-line-strong);
  background: var(--cover-bg); color: var(--cover-ink);
  font-family: var(--paper-title-font);
}
.verify-paper .vp-head .vp-label { font-size: 11px; letter-spacing: 5px; opacity: .82; }
.verify-paper .vp-head h2 { font-size: 22px; margin: 6px 0 2px; letter-spacing: 2px; }
.verify-paper .vp-head .vp-date { font-size: 11px; opacity: .8; }
.verify-paper .vp-body { padding: 22px 24px; }
.verify-paper .vp-row { display: flex; padding: 13px 0; border-bottom: 1px dashed var(--paper-line); font-size: 15px; }
.verify-paper .vp-row .vk { width: 82px; flex: 0 0 82px; color: var(--paper-muted); }
.verify-paper .vp-row .vv { flex: 1; font-weight: 650; }
.verify-paper .vp-row .vv.big { font-size: 27px; font-weight: 750; letter-spacing: .5px; }
.verify-paper .vp-stamp {
  margin: 20px 0 4px; text-align: center;
  color: var(--seal-color); font-family: var(--paper-title-font);
  font-size: 14px; letter-spacing: 2px; opacity: .85;
}
.verify-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.verify-ok {
  margin-top: 16px; padding: 14px; border-radius: 12px;
  background: #f0fdf4; color: var(--success); text-align: center;
  font-size: 13px; font-weight: 650;
}
.verify-note { margin-top: 14px; font-size: 11px; color: var(--text-3); text-align: center; line-height: 1.7; }

/* ---------- 9. 主题选择 ---------- */
.theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.theme-item {
  border: 2px solid var(--border); border-radius: 13px; overflow: hidden;
  background: var(--surface); transition: .18s; text-align: left;
}
.theme-item.active { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.theme-item .ti-preview { height: 84px; }
.theme-item .ti-info { padding: 10px 12px; display: flex; align-items: center; gap: 6px; }
.theme-item .ti-info .tin { font-size: 13px; font-weight: 650; flex: 1; }
.theme-item .ti-info .tick { color: var(--primary); }
.theme-item .ti-info .tick svg { width: 17px; height: 17px; }

/* ---------- 10. 覆盖层 / 提示 ---------- */
.overlay-root { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.modal-mask {
  position: absolute; inset: 0; background: rgba(15, 23, 42, .48);
  backdrop-filter: blur(3px); pointer-events: auto;
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%; max-width: 720px; background: var(--surface);
  border-radius: 22px 22px 0 0; padding: 20px 18px calc(24px + var(--safe-bottom));
  max-height: 88vh; overflow-y: auto; animation: slideUp .28s cubic-bezier(.2,.8,.2,1);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: none; } }
.modal-head { display: flex; align-items: center; margin-bottom: 18px; }
.modal-head h3 { font-size: 17px; margin: 0; flex: 1; }
.modal-head .close { width: 32px; height: 32px; border-radius: 9px; background: var(--surface-3); color: var(--text-2); display: grid; place-items: center; }
.modal-head .close svg { width: 17px; height: 17px; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions .btn { flex: 1; }

.toast-root { position: fixed; left: 50%; top: calc(var(--safe-top) + 14px); transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: calc(100% - 32px); max-width: 480px; }
.toast {
  background: rgba(15, 23, 42, .92); color: #fff; padding: 11px 17px;
  border-radius: 12px; font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg); animation: toastIn .26s ease both;
  display: flex; align-items: center; gap: 8px; max-width: 100%;
}
.toast svg { width: 16px; height: 16px; flex: 0 0 16px; }
.toast.success { background: #15803d; }
.toast.error { background: #b91c1c; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }
.toast.out { animation: toastOut .22s ease both; }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }

.confirm-text { font-size: 14px; color: var(--text-2); line-height: 1.8; }

/* ---------- 11. 响应式 ---------- */
@media (min-width: 720px) {
  .modal-mask { align-items: center; }
  .modal { border-radius: 20px; padding-bottom: 24px; max-width: 520px; }
}
@media (max-width: 360px) {
  .feature-grid { grid-template-columns: 1fr; }
  .share-grid { grid-template-columns: 1fr 1fr; }
  .hero h1 { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
