/* App 基础组件层 — 视图专属样式由各视图经 App.registerView 的 css 字段注入，命名前缀 .w{n}- */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: var(--font); background: #e8e9ec; color: var(--text-head-1);
  display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 12px 0;
}
:root[data-theme="dark"] body { background: #060708; }

/* 手机框 */
#phone {
  width: 375px; height: min(812px, calc(100vh - 24px)); background: var(--bg-000); border-radius: 24px;
  overflow: hidden; position: relative; box-shadow: 0 8px 40px rgba(0,0,0,.18);
  display: flex; flex-direction: column;
}
#statusbar { height: 34px; flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--sp-4); font-size: 12px; font-weight: 600; color: var(--text-head-1); background: var(--bg-000); }
#screen { flex: 1; overflow-y: auto; overscroll-behavior: contain; background: var(--bg-000); }
#screen::-webkit-scrollbar { display: none; }

/* 导航栏 */
.navbar { position: sticky; top: 0; z-index: 20; height: 44px; display: flex; align-items: center;
  background: var(--bg-000); padding: 0 var(--sp-2); }
.navbar .nav-back { width: 36px; height: 36px; border: 0; background: none; color: var(--text-head-1);
  font-size: 20px; cursor: pointer; }
.navbar .nav-title { flex: 1; text-align: center; font-size: 16px; font-weight: 600; color: var(--text-head-1); }
.navbar .nav-right { width: 36px; height: 36px; border: 0; background: none; color: var(--text-head-1);
  font-size: 17px; cursor: pointer; padding: 0; }
.navbar .nav-right:empty { pointer-events: none; }
.navbar .nav-right > [data-action] { display: flex; width: 100%; height: 100%; align-items: center; justify-content: center; }

/* 卡片与列表 */
.card { background: var(--bg-100); border-radius: var(--radius-lg); padding: var(--sp-4); }
.cell { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-3) 0; }
.cell + .cell { border-top: 0.5px solid var(--bg-200); }
.divider { height: 0.5px; background: var(--bg-200); }
.section-title { font-size: 16px; font-weight: 600; color: var(--text-head-1); margin: var(--sp-5) 0 var(--sp-3); }

/* 文字 */
.t-h1 { font-size: 18px; font-weight: 600; color: var(--text-head-1); }
.t-h2 { font-size: 14px; color: var(--text-head-2); }
.t-h3 { font-size: 12px; color: var(--text-head-3); }
.t-b1 { font-size: 14px; color: var(--text-body-1); }
.t-b2 { font-size: 12px; color: var(--text-body-2); }
.t-b3 { font-size: 11px; color: var(--text-body-3); }
.t-num { font-variant-numeric: tabular-nums; }
.t-up { color: var(--up); } .t-down { color: var(--down); }
.t-brand { color: var(--brand); }

/* 标签 */
.tag { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: var(--radius-sm);
  font-size: 10px; line-height: 1; }
.tag-safe { color: var(--hint-green); background: var(--up-bg); }         /* 保本（仅定活期） */
.tag-issuer { color: var(--hint-blue); background: rgba(30,122,253,.10); } /* 来源角标 */
.tag-hot { color: var(--hint-red); background: var(--down-bg); }
.tag-new { color: var(--brand); background: var(--brand-10); }
.tag-grey { color: var(--text-body-2); background: var(--bg-200); }

/* 按钮 */
.btn { display: flex; align-items: center; justify-content: center; width: 100%; height: 44px;
  border: 0; border-radius: var(--radius-md); font-size: 15px; font-weight: 600; cursor: pointer; font-family: var(--font); }
.btn-primary { background: var(--brand); color: #1D2125; }
.btn-primary:active { filter: brightness(.95); }
.btn-primary[disabled] { background: var(--bg-200); color: var(--text-disabled); cursor: not-allowed; }
.btn-ghost { background: var(--bg-200); color: var(--text-head-1); }
.btn-ghost[disabled] { color: var(--text-disabled); cursor: not-allowed; }
.btn-sm { height: 32px; font-size: 13px; padding: 0 var(--sp-4); width: auto; border-radius: var(--radius-pill); }

/* 输入 */
.input-row { display: flex; align-items: center; background: var(--bg-200); border-radius: var(--radius-md);
  padding: 0 var(--sp-3); height: 48px; }
.input-row input { flex: 1; border: 0; background: none; outline: none; font-size: 18px; font-weight: 600;
  color: var(--text-head-1); font-family: var(--font); min-width: 0; }
.input-row input::placeholder { color: var(--text-body-3); font-weight: 400; font-size: 14px; }

/* 底部弹层 sheet */
#sheet-mask { position: absolute; inset: 0; background: var(--mask); z-index: 40; opacity: 0; transition: opacity .2s; }
#sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 41; background: var(--bg-000);
  border-radius: 16px 16px 0 0; transform: translateY(100%); transition: transform .25s ease; max-height: 88%;
  display: flex; flex-direction: column; }
#sheet.open { transform: translateY(0); }
#sheet-mask.open { opacity: 1; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-4) var(--sp-4) var(--sp-2); }
.sheet-title { font-size: 16px; font-weight: 600; }
.sheet-close { border: 0; background: none; font-size: 18px; color: var(--text-head-3); cursor: pointer; }
.sheet-body { padding: 0 var(--sp-4) calc(var(--sp-6) + env(safe-area-inset-bottom)); overflow-y: auto; }

/* toast：顶部下滑通知条（奖励色 = 品牌金），替代居中遮挡式旧交互 */
#toast { position: absolute; left: 12px; right: 12px; top: 0; z-index: 60;
  background: var(--brand); color: #1D2125; font-size: 13px; font-weight: 600;
  padding: 12px 16px; border-radius: var(--radius-lg); text-align: center;
  box-shadow: 0 4px 16px rgba(243,184,36,.35);
  transform: translateY(-120%); opacity: 0; transition: transform .28s ease, opacity .28s ease;
  pointer-events: none; }
#toast.show { transform: translateY(42px); opacity: 1; }

/* 时间轴（交易规则/兑付计划/失败路径共用） */
.tl { position: relative; padding-left: 18px; }
.tl-item { position: relative; padding-bottom: var(--sp-4); }
.tl-item::before { content: ""; position: absolute; left: -14px; top: 5px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--bg-300); }
.tl-item::after { content: ""; position: absolute; left: -11px; top: 14px; bottom: 0; width: 1px; background: var(--bg-200); }
.tl-item:last-child::after { display: none; }
.tl-item.done::before { background: var(--up); }
.tl-item.fail::before { background: var(--down); }
.tl-item .tl-t { font-size: 13px; color: var(--text-head-1); }
.tl-item .tl-d { font-size: 11px; color: var(--text-body-2); margin-top: 2px; }

/* 空态 */
.empty { text-align: center; padding: 48px 0; color: var(--text-body-3); font-size: 13px; }
.empty .empty-ic { font-size: 34px; margin-bottom: var(--sp-2); opacity: .5; }

/* Tab 条 */
.tabs { display: flex; gap: var(--sp-5); padding: var(--sp-2) 0; }
.tabs .tab { border: 0; background: none; font-size: 14px; color: var(--text-body-2); cursor: pointer;
  padding: 6px 0; position: relative; font-family: var(--font); }
.tabs .tab.active { color: var(--text-head-1); font-weight: 600; }
.tabs .tab.active::after { content: ""; position: absolute; left: 25%; right: 25%; bottom: 0; height: 3px;
  border-radius: 2px; background: var(--brand); }

/* 页面主体通用 padding */
.page { padding: 0 var(--sp-4) var(--sp-8); }

/* debug 面板 */
#debug-fab { position: absolute; right: 10px; bottom: 90px; z-index: 70; width: 40px; height: 40px;
  border-radius: 50%; border: 0; background: var(--text-head-1); color: var(--bg-000); font-size: 16px;
  cursor: pointer; opacity: .75; }
#debug-panel { position: absolute; right: 8px; bottom: 138px; z-index: 70; width: 230px; background: var(--bg-000);
  border: 1px solid var(--bg-300); border-radius: var(--radius-lg); padding: var(--sp-3); display: none;
  box-shadow: 0 4px 24px rgba(0,0,0,.2); font-size: 12px; max-height: 480px; overflow-y: auto; }
#debug-panel.open { display: block; }
#debug-panel h4 { font-size: 11px; color: var(--text-head-3); margin: var(--sp-2) 0 var(--sp-1); text-transform: uppercase; }
#debug-panel .dbg-row { display: flex; flex-wrap: wrap; gap: var(--sp-1); }
#debug-panel .dbg-btn { border: 1px solid var(--bg-300); background: var(--bg-100); color: var(--text-body-1);
  border-radius: var(--radius-sm); font-size: 11px; padding: 3px 7px; cursor: pointer; font-family: var(--font); }
#debug-panel .dbg-btn.on { background: var(--brand); border-color: var(--brand); color: #1D2125; }

/* 乱序安全数字键盘（交易密码） */
.pwd-dots { display: flex; justify-content: center; gap: 14px; margin: var(--sp-2) 0 var(--sp-5); }
.pwd-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--bg-300); transition: background .12s; }
.pwd-dot.on { background: var(--text-head-1); }
.pwd-kb { display: flex; flex-direction: column; gap: 8px; padding-bottom: var(--sp-2); }
.pwd-kb-row { display: flex; gap: 8px; }
.pwd-key { flex: 1; height: 48px; border: 0; border-radius: var(--radius-md); background: var(--bg-100);
  font-size: 20px; font-weight: 600; color: var(--text-head-1); cursor: pointer; font-family: var(--font);
  display: flex; align-items: center; justify-content: center; }
.pwd-key:active { background: var(--bg-300); }
.pwd-key.blank { background: none; pointer-events: none; }
.pwd-key.fn { background: none; color: var(--text-head-2); }

/* 运营 banner 主题（W1；375px 内嵌卡，纯 CSS 无外部图） */
.bn-card { position: relative; overflow: hidden; border-radius: var(--radius-lg); height: 92px;
  display: flex; flex-direction: column; justify-content: center; padding: 0 var(--sp-4); cursor: pointer; }
.bn-card .bn-title { color: #fff; font-size: 15px; font-weight: 700; position: relative; z-index: 2; }
.bn-card .bn-sub { color: rgba(255,255,255,.72); font-size: 11px; margin-top: 4px; position: relative; z-index: 2; }
.bn-card .bn-cta { position: absolute; right: 14px; bottom: 12px; z-index: 2; color: rgba(255,255,255,.85);
  font-size: 11px; display: flex; align-items: center; gap: 2px; }
.bn-card .bn-deco { position: absolute; right: -10px; top: 50%; transform: translateY(-50%) rotate(-8deg);
  opacity: .16; color: #fff; z-index: 1; pointer-events: none; }
.bn-card .bn-glow { position: absolute; width: 130px; height: 130px; border-radius: 50%; right: 24px; top: -46px;
  filter: blur(2px); z-index: 0; pointer-events: none; }
.bn-quant { background: linear-gradient(115deg, #16191d 0%, #23261d 55%, #4a3b14 100%); }
.bn-quant .bn-glow { background: radial-gradient(circle, rgba(243,184,36,.35), transparent 70%); }
.bn-gift { background: linear-gradient(115deg, #0c2a20 0%, #14523c 60%, #18AE83 130%); }
.bn-gift .bn-glow { background: radial-gradient(circle, rgba(255,255,255,.22), transparent 70%); }
.bn-rwa { background: linear-gradient(115deg, #1c1533 0%, #35276b 65%, #6a4fd8 140%); }
.bn-rwa .bn-glow { background: radial-gradient(circle, rgba(160,130,255,.4), transparent 70%); }
.bn-brand { background: linear-gradient(115deg, #2a2007 0%, #7a5c10 70%, #F3B824 160%); }
.bn-brand .bn-glow { background: radial-gradient(circle, rgba(255,220,120,.35), transparent 70%); }

/* 密码点抖动（输错反馈） */
@keyframes pwd-shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-6px)} 75%{transform:translateX(6px)} }
.pwd-dots.shake { animation: pwd-shake .3s ease; }
