/* ==========================================================================
   Youbi Wallet —— 样式（OneKey 风格）

   视觉语言取自 OneKey 现行界面（从官方 App Store 截图实测取色）：
     · 品牌色：荧光绿 #00FF00（OneKey 招牌）
     · 主操作按钮：深绿 #008236 胶囊
     · 危险 / 风险：红 #CD2B30，警示条底 #FEEBEC
     · 底色：纯白（浅色）/ 近黑 #0D0D0D（深色）
     · 大圆角、粗体数字、极简卡片

   规则不变：所有颜色都走 CSS 变量，结构里不出现任何"只适合深色"的硬编码颜色。

   字体：Manrope（OFL 许可）自托管，作为 OneKey 商用字体 Roobert 的免费近似替代。
   只做视觉风格的对齐，不含任何来自 OneKey 的代码或资源。
   ========================================================================== */

@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('vendor/fonts/manrope.woff2') format('woff2');
}

/* ---------------- 深色（默认） ---------------- */
:root,
[data-theme='dark'] {
  --bg: #0d0d0d;
  --bg-2: #141414;
  --panel: #1a1a1a;
  --panel-2: #212121;
  --panel-3: #171717;
  --line: #2a2a2a;
  --line-2: #3a3a3a;

  --tx: #f7f7f7;
  --tx-2: #a3a3a3;
  --tx-3: #6f6f6f;

  --brand: #00d64f;
  --brand-2: #00ff7a;
  --brand-glow: #00ff00;
  --brand-ink: #052a12;
  --brand-soft: rgba(0, 255, 0, 0.1);

  --hero-from: #00ff00;
  --hero-to: #00e84d;
  --hero-tx: #0a0a0a;
  --hero-sub: rgba(10, 10, 10, 0.62);
  --hero-line: rgba(10, 10, 10, 0.14);

  --ok-bg: rgba(0, 214, 79, 0.14);
  --ok-line: rgba(0, 214, 79, 0.36);
  --ok-tx: #38e07b;
  --warn-bg: rgba(255, 149, 0, 0.14);
  --warn-line: rgba(255, 149, 0, 0.36);
  --warn-tx: #ffb340;
  --danger-bg: rgba(205, 43, 48, 0.16);
  --danger-line: rgba(255, 87, 87, 0.38);
  --danger-tx: #ff6b6b;
  --crit-bg: rgba(183, 21, 21, 0.22);
  --crit-line: rgba(255, 87, 87, 0.5);
  --crit-tx: #ff8a8a;

  --input-bg: #171717;
  --hover: #232323;
  --overlay: rgba(0, 0, 0, 0.72);
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  --screen-bg: #050a05;
  --screen-line: #12220f;
  --screen-tx: #4dff88;
  --screen-dim: #3d5546;
  --qr-plate: #ffffff;
  --btn-face: linear-gradient(180deg, #00ff40, #00d64f);
}

/* ---------------- 浅色 ---------------- */
[data-theme='light'] {
  --bg: #ffffff;
  --bg-2: #ffffff;
  --panel: #ffffff;
  --panel-2: #f7f8f7;
  --panel-3: #f1f2f1;
  --line: #ebedeb;
  --line-2: #dcdfdc;

  --tx: #111111;
  --tx-2: #6b6b6b;
  --tx-3: #9a9a9a;

  --brand: #008236;
  --brand-2: #00a344;
  --brand-glow: #00ff00;
  --brand-ink: #ffffff;
  --brand-soft: rgba(0, 130, 54, 0.09);

  --hero-from: #00ff00;
  --hero-to: #00f04a;
  --hero-tx: #0a0a0a;
  --hero-sub: rgba(10, 10, 10, 0.6);
  --hero-line: rgba(10, 10, 10, 0.13);

  --ok-bg: #e8f8ee;
  --ok-line: #b3e6c8;
  --ok-tx: #00672a;
  --warn-bg: #fef4e8;
  --warn-line: #f5d9ae;
  --warn-tx: #9a5412;
  --danger-bg: #feeced;
  --danger-line: #f8bfc1;
  --danger-tx: #b02328;
  --crit-bg: #feeced;
  --crit-line: #f5a9ac;
  --crit-tx: #8f1418;

  --input-bg: #f7f8f7;
  --hover: #eaedea;
  --overlay: rgba(17, 17, 17, 0.42);
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.1);
  --screen-bg: #0a0f0a;
  --screen-line: #1c2a1c;
  --screen-tx: #4dff88;
  --screen-dim: #5b7a66;
  --qr-plate: #ffffff;
  --btn-face: linear-gradient(180deg, #0a9a44, #008236);
}

:root {
  --radius: 14px;
  --radius-card: 18px;
  --radius-lg: 22px;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--tx);
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI',
    'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button { font-family: inherit; }
a { color: var(--brand); }

.view { display: none; }
.view.active { display: block; }

/* ---------------- 引导页通用件 ---------------- */
.wrap-narrow { max-width: 520px; margin: 0 auto; padding: 48px 20px 80px; }
.logo-row { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
.logo-mark {
  width: 32px; height: 32px; border-radius: 10px;
  background: var(--brand-glow);
  display: grid; place-items: center;
  font-weight: 800; font-size: 15px; color: #0a0a0a;
  flex: 0 0 32px;
}
.logo-mark.lg { width: 46px; height: 46px; flex-basis: 46px; font-size: 21px; border-radius: 14px; }
.logo-name { font-weight: 800; letter-spacing: -0.2px; }
.logo-tag { font-size: 11px; color: var(--tx-3); letter-spacing: 0.6px; text-transform: uppercase; }

h1 { font-size: 27px; line-height: 1.24; margin: 0 0 10px; font-weight: 800; letter-spacing: -0.025em; }
h2 { font-size: 16px; margin: 0 0 12px; font-weight: 800; letter-spacing: -0.01em; }
h3 { font-size: 13px; margin: 0 0 8px; font-weight: 700; color: var(--tx-2); letter-spacing: 0.3px; }
p.lead { color: var(--tx-2); line-height: 1.68; margin: 0 0 22px; }
p.note { color: var(--tx-3); font-size: 12px; line-height: 1.6; margin: 10px 0 0; }

.card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 18px;
  margin-bottom: 14px;
}
.card.plain { background: var(--panel-2); }
.card.danger { border-color: var(--danger-line); background: var(--danger-bg); }
.card.warn { border-color: var(--warn-line); background: var(--warn-bg); }
.card.ok { border-color: var(--ok-line); background: var(--ok-bg); }
.card.tight { padding: 4px 16px; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent;
  background: var(--panel-3);
  color: var(--tx);
  padding: 11px 16px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 640;
  cursor: pointer;
  transition: 0.15s;
  width: 100%;
}
.btn:hover:not(:disabled) { background: var(--hover); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary {
  background: var(--btn-face); color: var(--brand-ink);
  border-radius: 999px; font-weight: 800; letter-spacing: -0.01em;
}
.btn.primary:hover:not(:disabled) { filter: brightness(1.06); background: var(--btn-face); }
.btn.danger { border-color: var(--danger-line); color: var(--danger-tx); background: var(--danger-bg); }
.btn.danger:hover:not(:disabled) { background: var(--danger-bg); filter: brightness(1.04); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 7px 12px; font-size: 12.5px; width: auto; border-radius: 10px; font-weight: 640; }
.btn.icon { width: 34px; height: 34px; padding: 0; font-size: 15px; border-radius: 11px; }
.btn-row { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.btn-row .btn { width: auto; flex: 1; }
.btn-row.wrap0 { flex-wrap: nowrap; }

/* ---------------- 表单 ---------------- */
label.fld { display: block; margin-bottom: 14px; }
label.fld > span { display: block; font-size: 12px; color: var(--tx-2); margin-bottom: 6px; letter-spacing: 0.2px; font-weight: 600; }
input[type='text'], input[type='password'], textarea, select {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--line);
  color: var(--tx);
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: 0.15s;
}
select { appearance: none; background-image: none; cursor: pointer; }
input:focus, textarea:focus, select:focus { border-color: var(--brand); }
textarea { resize: vertical; min-height: 88px; font-family: var(--mono); font-size: 13px; line-height: 1.6; }
input.mono, .mono { font-family: var(--mono); }
.field-hint { font-size: 11.5px; color: var(--tx-3); margin-top: 5px; line-height: 1.5; }

.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.toggle-row:last-child { border-bottom: none; }
.toggle-row .tl { font-size: 13.5px; font-weight: 600; }
.toggle-row .td { font-size: 11.5px; color: var(--tx-3); margin-top: 3px; line-height: 1.5; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 11px; overflow: hidden; flex: 0 0 auto; }
.seg button {
  border: none; background: var(--panel-2); color: var(--tx-2);
  font-size: 12px; font-weight: 600; padding: 7px 12px; cursor: pointer; transition: 0.15s;
}
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--brand); color: var(--brand-ink); font-weight: 700; }

/* 开关 */
.switch { width: 42px; height: 24px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel-3); position: relative; cursor: pointer; flex: 0 0 42px; transition: 0.18s; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--tx-3); transition: 0.18s; }
.switch.on { background: var(--brand); border-color: transparent; }
.switch.on::after { left: 20px; background: #fff; }

/* ---------------- 助记词展示 ---------------- */
.mnemonic-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 6px; }
.mnemonic-grid .w {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 11px; padding: 9px 10px;
  font-family: var(--mono); font-size: 12.5px;
  display: flex; gap: 7px; align-items: baseline;
}
.mnemonic-grid .w b { color: var(--tx-3); font-weight: 500; font-size: 10.5px; min-width: 14px; }
.mnemonic-grid.blur .w { filter: blur(5px); user-select: none; }

.check { display: flex; gap: 9px; align-items: flex-start; margin: 14px 0; cursor: pointer; }
.check input { margin-top: 2px; accent-color: var(--brand); }
.check span { font-size: 13px; color: var(--tx-2); line-height: 1.55; }

/* ---------------- 主界面骨架 ---------------- */
#view-app.active { display: flex; height: 100vh; }

.sidebar {
  width: 226px; flex: 0 0 226px;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  display: flex; flex-direction: column; gap: 4px;
  overflow-y: auto;
}
.side-brand { display: flex; align-items: center; gap: 9px; padding: 4px 8px 16px; }
.nav-group-label { font-size: 10.5px; color: var(--tx-3); letter-spacing: 0.8px; text-transform: uppercase; padding: 14px 10px 6px; font-weight: 700; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 12px;
  color: var(--tx-2); cursor: pointer; font-size: 13.5px; font-weight: 600;
  border: 1px solid transparent; transition: 0.13s;
  background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--panel-2); color: var(--tx); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 800; }
.nav-item .ico { width: 16px; text-align: center; opacity: 0.9; flex: 0 0 16px; }
.nav-item .badge { margin-left: auto; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); }
.side-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }

.main { flex: 1; overflow-y: auto; padding: 26px 32px 90px; }
.main-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.main-head h1 { font-size: 22px; margin-bottom: 4px; }
.main-head .sub { color: var(--tx-3); font-size: 12.5px; }
.head-right { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.panel { max-width: 880px; }
.panel[hidden] { display: none; }

/* ---------------- 资产：总览卡 ---------------- */
.hero {
  border-radius: var(--radius-lg);
  background: linear-gradient(150deg, var(--hero-from), var(--hero-to));
  color: var(--hero-tx);
  padding: 22px 24px;
  margin-bottom: 16px;
  border: 1px solid var(--hero-line);
}
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.hero-label { font-size: 12px; color: var(--hero-sub); letter-spacing: 0.2px; font-weight: 700; }
.hero-total {
  font-size: 38px; font-weight: 800; letter-spacing: -0.035em; line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.hero-total .cur { font-size: 20px; font-weight: 700; opacity: 0.72; margin-right: 3px; }
.hero-sub { font-size: 11.5px; color: var(--hero-sub); margin-top: 7px; font-weight: 600; }
.hero-addr {
  margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--hero-line);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.addr-full { font-family: var(--mono); font-size: 12.5px; word-break: break-all; flex: 1; min-width: 180px; }
.hero .addr-full { color: var(--hero-tx); }

.acct-switch {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  background: rgba(10, 10, 10, 0.08); border: 1px solid var(--hero-line);
  border-radius: 999px; padding: 5px 12px 5px 8px; color: var(--hero-tx);
  font-size: 12.5px; font-weight: 700; transition: 0.15s;
}
.acct-switch:hover { background: rgba(10, 10, 10, 0.14); }
.acct-switch .av {
  width: 20px; height: 20px; border-radius: 50%; flex: 0 0 20px;
  background: #ffffff; color: #0a7a34;
  display: grid; place-items: center; font-size: 10.5px; font-weight: 800;
}
.acct-switch .caret { opacity: 0.8; font-size: 10px; }

/* 快捷操作 */
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.quick button {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-card);
  padding: 14px 8px; cursor: pointer; color: var(--tx); transition: 0.15s;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.quick button:hover { background: var(--hover); border-color: var(--line-2); }
.quick .qico {
  width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand); font-size: 16px;
}
.quick .ql { font-size: 12.5px; font-weight: 700; }
.quick button:disabled { opacity: 0.45; cursor: not-allowed; }

/* 资产列表 */
.asset-list { padding: 4px 0; }
.asset-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 0; border-bottom: 1px solid var(--line);
}
.asset-row:last-child { border-bottom: none; }
.token-mark {
  width: 38px; height: 38px; border-radius: 50%; flex: 0 0 38px;
  display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #fff;
  letter-spacing: -0.3px;
}
.asset-mid { flex: 1; min-width: 0; }
.asset-name { font-size: 13.5px; font-weight: 700; }
.asset-net { font-size: 11px; color: var(--tx-3); margin-top: 2px; }
.asset-right { text-align: right; flex: 0 0 auto; }
.asset-amt { font-size: 13.5px; font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 600; }
.asset-fiat { font-size: 11px; color: var(--tx-3); margin-top: 2px; font-variant-numeric: tabular-nums; }
.asset-row.disabled .asset-amt { color: var(--tx-3); }

.chain-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.chain-row:last-child { border-bottom: none; }
.chain-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.chain-name { flex: 1; font-size: 13.5px; font-weight: 600; }
.chain-bal { font-family: var(--mono); font-size: 13px; color: var(--tx-2); }
.chain-bal.loading { color: var(--tx-3); }

/* ---------------- 收款 ---------------- */
.qr-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.qr-plate {
  width: 220px; height: 220px; padding: 14px; border-radius: 20px;
  background: var(--qr-plate); border: 1px solid var(--line);
  display: grid; place-items: center;
}
.qr-plate svg { width: 100%; height: 100%; display: block; }
.qr-cap { font-size: 11.5px; color: var(--tx-3); text-align: center; line-height: 1.6; }

/* ---------------- 账户管理 ---------------- */
.acct-card {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--line); border-radius: 16px; padding: 13px 14px;
  margin-bottom: 10px; background: var(--panel-2); cursor: pointer; transition: 0.14s;
}
.acct-card:hover { background: var(--hover); }
.acct-card.selected { border-color: var(--brand); background: var(--brand-soft); }
.acct-av {
  width: 40px; height: 40px; border-radius: 50%; flex: 0 0 40px;
  display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff;
}
.acct-mid { flex: 1; min-width: 0; }
.acct-name { font-size: 13.5px; font-weight: 700; display: flex; align-items: center; gap: 7px; }
.acct-addr { font-size: 11px; color: var(--tx-3); font-family: var(--mono); margin-top: 3px; word-break: break-all; }
.tag-now { font-size: 10px; padding: 1px 7px; border-radius: 999px; background: var(--ok-bg); color: var(--ok-tx); border: 1px solid var(--ok-line); font-weight: 700; }

/* ---------------- 地址簿 ---------------- */
.kv { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--tx-3); flex: 0 0 auto; }
.kv .v { text-align: right; word-break: break-all; }
.kv .v.mono { font-family: var(--mono); font-size: 12.5px; }

/* ---------------- 清签预览 ---------------- */
.preview-head { font-size: 17px; font-weight: 800; line-height: 1.42; margin-bottom: 4px; letter-spacing: -0.015em; }
.preview-head.danger { color: var(--crit-tx); }
.preview-head.warn { color: var(--warn-tx); }
.risk-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  border: 1px solid transparent; margin-bottom: 10px;
}
.risk-badge.low { background: var(--ok-bg); color: var(--ok-tx); border-color: var(--ok-line); }
.risk-badge.medium { background: var(--warn-bg); color: var(--warn-tx); border-color: var(--warn-line); }
.risk-badge.high { background: var(--danger-bg); color: var(--danger-tx); border-color: var(--danger-line); }
.risk-badge.critical { background: var(--crit-bg); color: var(--crit-tx); border-color: var(--crit-line); }

.reason {
  display: flex; gap: 9px; padding: 10px 12px; border-radius: 12px;
  font-size: 12.5px; line-height: 1.62; margin-bottom: 8px;
  background: var(--panel-2); border: 1px solid var(--line);
}
.reason.medium { background: var(--warn-bg); border-color: var(--warn-line); }
.reason.high { background: var(--danger-bg); border-color: var(--danger-line); }
.reason.critical { background: var(--crit-bg); border-color: var(--crit-line); }
.reason:last-child { margin-bottom: 0; }
.reason .dot { flex: 0 0 auto; margin-top: 1px; }

/* 首页顶部演示警示（公开部署时提醒陌生人不要放真钱）
   样式对齐 OneKey 的风险警示条：浅粉底 + 红字 + 红色标题 */
.demo-banner {
  margin-top: 18px; padding: 14px 16px; border-radius: 16px;
  background: var(--crit-bg); border: 1px solid var(--crit-line);
}
.demo-banner .db-title { color: var(--crit-tx); font-weight: 800; font-size: 14px; margin-bottom: 7px; letter-spacing: -0.01em; }
.demo-banner .db-body { color: var(--tx-2); font-size: 12.5px; line-height: 1.68; }
.demo-banner strong { color: var(--tx); font-weight: 700; }

.ln { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.ln:last-child { border-bottom: none; }
.ln .l { color: var(--tx-3); flex: 0 0 auto; }
.ln .r { text-align: right; word-break: break-all; }
.ln .r.mono { font-family: var(--mono); font-size: 12.5px; }
.ln .r.small { font-size: 11px; color: var(--tx-2); }
.ln .r.warn { color: var(--warn-tx); }
.ln .r.danger { color: var(--danger-tx); font-weight: 700; }
.ln .r.muted { color: var(--tx-3); }

/* ---------------- 虚拟设备 ---------------- */
.device-mock {
  border-radius: 24px; border: 1px solid var(--line-2);
  background: linear-gradient(170deg, var(--panel-2), var(--panel-3));
  padding: 18px; margin: 14px 0; box-shadow: var(--shadow);
}
.device-mock .dev-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.device-mock .dev-title { font-size: 12px; color: var(--tx-3); letter-spacing: 0.6px; text-transform: uppercase; font-weight: 700; }
.led-row { display: flex; gap: 6px; }
.led { width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); }
.led.on { background: var(--ok-tx); }
.led.blink { animation: blink 1s infinite; background: var(--warn-tx); }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

.device-screen {
  background: var(--screen-bg); border: 1px solid var(--screen-line); border-radius: 16px;
  padding: 14px; min-height: 96px; font-family: var(--mono); font-size: 12px;
  line-height: 1.65; color: var(--screen-tx); word-break: break-all;
}
.device-screen.blank { display: grid; place-items: center; color: var(--screen-dim); font-family: inherit; font-size: 12.5px; text-align: center; padding: 22px 14px; }
.device-screen .dim { color: var(--screen-dim); font-size: 11px; }
.blind-code { font-family: var(--mono); font-size: 15px; letter-spacing: 2.5px; color: var(--tx-2); text-align: center; padding: 12px 0; }
.device-phys { display: flex; gap: 10px; align-items: center; justify-content: center; margin-top: 12px; }
.phys-btn {
  width: 56px; height: 56px; border-radius: 50%;
  border: 2px solid var(--line-2); background: var(--panel-2); color: var(--tx-2);
  cursor: pointer; font-size: 11px; font-weight: 700; line-height: 1.3; transition: 0.15s;
}
.phys-btn:hover:not(:disabled) { border-color: var(--brand); color: var(--tx); }
.phys-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------------- 设备列表 ---------------- */
.dev-card { border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 10px; background: var(--panel-2); cursor: pointer; transition: 0.14s; }
.dev-card:hover { background: var(--hover); }
.dev-card.selected { border-color: var(--brand); background: var(--brand-soft); }
.dev-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dev-name { font-weight: 800; font-size: 14px; letter-spacing: -0.01em; }
.dev-model { font-size: 11.5px; color: var(--tx-3); margin-top: 2px; }
.pill { font-size: 10.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--tx-3); white-space: nowrap; }
.pill.ok { color: var(--ok-tx); border-color: var(--ok-line); background: var(--ok-bg); }
.pill.warn { color: var(--warn-tx); border-color: var(--warn-line); background: var(--warn-bg); }
.cap-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.cap-tag { font-size: 11px; padding: 3px 9px; border-radius: 8px; background: var(--panel-3); border: 1px solid var(--line); color: var(--tx-2); }
.cap-tag.no { color: var(--danger-tx); border-color: var(--danger-line); }
.cap-tag.yes { color: var(--ok-tx); border-color: var(--ok-line); }

/* ---------------- 记录 ---------------- */
.act { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.act:last-child { border-bottom: none; }
.act .b { flex: 1; min-width: 0; }
.act .t { color: var(--tx-3); font-size: 11px; }
.act .h { font-weight: 700; margin: 3px 0 4px; line-height: 1.5; }
.act .m { color: var(--tx-3); font-family: var(--mono); font-size: 11px; word-break: break-all; }
.act .lvl { flex: 0 0 auto; }

/* ---------------- 空状态 ---------------- */
.empty { text-align: center; padding: 34px 18px; }
.empty .eico { font-size: 26px; color: var(--tx-3); margin-bottom: 10px; }
.empty .et { font-size: 13.5px; font-weight: 700; margin-bottom: 6px; }
.empty .ed { font-size: 12px; color: var(--tx-3); line-height: 1.6; max-width: 320px; margin: 0 auto; }

/* ---------------- 弹窗 ---------------- */
.modal-back {
  position: fixed; inset: 0; background: var(--overlay);
  backdrop-filter: blur(4px); display: grid; place-items: center;
  padding: 20px; z-index: 100;
}
.modal-back[hidden] { display: none; }
.modal {
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 20px;
  width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto; padding: 22px;
  box-shadow: var(--shadow);
}
.modal h2 { font-size: 16px; margin-bottom: 14px; }
.modal .btn-row { margin-top: 6px; }
.modal .list-pick { max-height: 46vh; overflow-y: auto; }

/* ---------------- 提示条 ---------------- */
#toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(12px);
  background: var(--panel-2); border: 1px solid var(--line-2); color: var(--tx);
  padding: 11px 18px; border-radius: 999px; font-size: 13px; font-weight: 600; z-index: 200;
  opacity: 0; transition: 0.22s; pointer-events: none; max-width: 88vw; text-align: center;
  box-shadow: var(--shadow);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { border-color: var(--crit-line); color: var(--crit-tx); }

.steps { display: flex; gap: 6px; margin-bottom: 20px; }
.steps i { flex: 1; height: 3px; border-radius: 2px; background: var(--line); }
.steps i.on { background: var(--brand-glow); }

.spin {
  width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.22); border-top-color: #fff;
  animation: sp 0.7s linear infinite; display: inline-block;
}
.btn:not(.primary):not(.danger) .spin { border-color: var(--line-2); border-top-color: var(--brand); }
@keyframes sp { to { transform: rotate(360deg); } }

.sep { height: 1px; background: var(--line); margin: 16px 0; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ---------------- 移动端 ---------------- */
@media (max-width: 860px) {
  #view-app.active { flex-direction: column; height: 100vh; }
  .sidebar {
    order: 2;
    position: fixed; left: 0; right: 0; bottom: 0;
    width: 100%; flex: none; flex-direction: row;
    flex-wrap: wrap;                 /* 排成两行，保证 8 个入口一屏可见，不用横向滑动 */
    justify-content: space-between;
    overflow: visible;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    border-right: none; border-top: 1px solid var(--line);
    gap: 2px 0; z-index: 50;
    background: var(--bg-2);
  }
  .side-brand, .side-foot, .nav-group-label { display: none; }
  .nav-item { flex: 1 1 22%; flex-direction: column; gap: 3px; font-size: 10.5px; padding: 6px 2px; white-space: nowrap; width: auto; border-radius: 12px; }
  .nav-item .ico { font-size: 15px; width: auto; flex-basis: auto; }
  .nav-item .badge { margin-left: 0; }
  .main { order: 1; padding: 16px 15px 130px; }
  .main-head { margin-bottom: 14px; }
  .main-head h1 { font-size: 20px; }
  .hero { padding: 18px 18px; border-radius: 20px; }
  .hero-total { font-size: 32px; }
  .mnemonic-grid { grid-template-columns: repeat(2, 1fr); }
  .quick { gap: 8px; }
  .quick button { padding: 12px 4px; }
  .wrap-narrow { padding: 30px 18px 70px; }
  .modal { border-radius: 18px; padding: 18px; }
}
