/* Dark wallet UI with light theme support */

:root {
  --bg: #000;
  --surface: #0a0a0a;
  --surface-elevated: #111112;
  --card: #141416;
  --input: #1c1c1e;
  --border: rgba(255,255,255,.05);
  --text: #fff;
  --text-secondary: #b0b0b0;
  --text-muted: #7a7a7a;
  --accent: #6c5ce7;
  --accent-light: #7c5cff;
  --green: #2ecc71;
  --red: #ff5b5b;
  --error: #f87171;
  --splash: #521fff;
  --keypad: #1b1b1e;
  --keypad-key: #3b3b42;
  --keypad-key-active: #52525a;
}

body.light {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-elevated: #f9f9fb;
  --card: #ffffff;
  --input: #f0f0f2;
  --border: rgba(0,0,0,.08);
  --text: #111;
  --text-secondary: #555;
  --text-muted: #888;
  --accent: #6c5ce7;
  --accent-light: #7c5cff;
  --green: #16a34a;
  --red: #dc2626;
  --error: #dc2626;
  --splash: #521fff;
  --keypad: #e8e8ec;
  --keypad-key: #d8d8de;
  --keypad-key-active: #c4c4cc;
}

/* Admin panel visibility — gated by PIN */
.admin-panel > *:not(.admin-pin-gate) { display: none; }
.admin-panel.admin-unlocked > .admin-pin-gate { display: none; }
.admin-panel.admin-unlocked > .admin-layout { display: flex; }
.admin-panel.admin-unlocked > .admin-header,
.admin-panel.admin-unlocked > .admin-msg,
.admin-panel.admin-unlocked > .admin-section,
.admin-panel.admin-unlocked > .admin-section * { display: revert; }

.admin-pin-gate {
  position: fixed; inset: 0; z-index: 2001;
  background: var(--surface);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px; text-align: center;
}
.admin-pin-title { font-size: 22px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.admin-pin-sub { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }
.admin-pin-boxes { display: flex; gap: 12px; margin-bottom: 12px; }
.admin-pin-box {
  width: 16px; height: 16px; border-radius: 50%;
  border: 1px solid var(--text-muted); background: transparent;
  transition: all .15s;
}
.admin-pin-box.filled { background: var(--text); border-color: var(--text); }
.admin-pin-error { min-height: 20px; color: var(--error); font-size: 13px; margin-bottom: 14px; }
.admin-pin-keypad {
  display: grid; grid-template-columns: repeat(3, 64px); gap: 14px;
}
.admin-pin-keypad button {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--input); border: 0; color: var(--text); font-size: 22px; font-weight: 500;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.admin-pin-keypad button:active { background: var(--text-muted); }
body.light .admin-pin-keypad button:active { background: var(--keypad-key-active); }
.admin-pin-keypad button.empty { background: transparent; cursor: default; }
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
[hidden] { display: none !important; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  font-synthesis: none;
  font-weight: 600;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background .2s, color .2s;
}
* { font-weight: inherit; }
body.auth-locked { overflow: hidden; }

/* Theme toggle icons */
.theme-moon, .theme-sun { display: block; width: 22px; height: 22px; }
body.light .theme-moon { display: none; }
body:not(.light) .theme-sun { display: none; }

/* Pull-to-refresh indicator */
.pull-indicator {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  height: 0; overflow: hidden; opacity: 0;
  color: var(--text-muted); font-size: 14px;
  transition: height .15s ease, opacity .15s ease;
  will-change: height;
}
.pull-indicator.active { opacity: 1; }
.pull-indicator .pull-arrow,
.pull-indicator .pull-check { width: 18px; height: 18px; flex: none; display: none; }
.pull-indicator .pull-spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid #4a4658; border-top-color: #a5a1b3;
  display: none; animation: spinR .8s linear infinite;
}
@keyframes spinR { to { transform: rotate(360deg); } }
.pull-indicator[data-state="pull"] .pull-arrow { display: block; transition: transform .15s; }
.pull-indicator[data-state="release"] .pull-arrow { display: block; transform: rotate(180deg); transition: transform .15s; }
.pull-indicator[data-state="loading"] .pull-spinner { display: block; }
.pull-indicator[data-state="done"] .pull-check { display: block; color: #d1cfdd; }

/* Eye toggle */
.eye-btn { background: transparent; border: 0; padding: 2px 4px; color: inherit; cursor: pointer; display: inline-flex; }
.eye-btn svg { width: 18px; height: 18px; }
.eye-btn .eye-closed { display: none; }
body.balance-hidden .eye-btn .eye-open { display: none; }
body.balance-hidden .eye-btn .eye-closed { display: inline-block; }
body.balance-hidden .balance-amount,
body.balance-hidden .balance-btc,
body.balance-hidden .balance-change { color: transparent; user-select: none; pointer-events: none; }
body.balance-hidden .balance-amount::before { content: "*******"; color: var(--text); font-size: inherit; font-weight: inherit; display: block; }
body.balance-hidden .balance-btc::before { content: "****** BTC"; color: var(--text-secondary); font-size: inherit; font-weight: 500; display: block; }
body.balance-hidden .balance-change::before { content: "******"; color: var(--text-secondary); font-size: inherit; display: block; }
body.balance-hidden .coin-qty { color: transparent; user-select: none; }
body.balance-hidden .coin-qty::before { content: "*******"; color: var(--text); font-size: inherit; font-weight: 600; display: block; text-align: right; }
body.balance-hidden .coin-usd { color: transparent; user-select: none; }
body.balance-hidden .coin-usd::before { content: "*******"; color: var(--text-secondary); font-size: inherit; display: block; text-align: right; }

/* ==== Launch and security-password flow ==== */
.entry-screen {
  position: fixed;
  z-index: 1000;
  inset: 0;
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--surface);
  color: var(--text);
}

.splash-screen { background: var(--splash); }
.splash-screen img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.unlock-screen,
.pin-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.unlock-copy {
  width: 100%;
  padding: clamp(92px, 15vh, 160px) 22px 0;
  text-align: center;
}
.unlock-copy h1 {
  font-size: clamp(30px, 7vw, 39px);
  font-weight: 700;
  line-height: 1.15;
  color: var(--text);
}
.unlock-copy p {
  margin-top: 26px;
  color: var(--text-muted);
  font-size: clamp(16px, 4.2vw, 20px);
  line-height: 1.35;
}
.fingerprint-action {
  margin-top: clamp(112px, 18vh, 190px);
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: default;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}
.fingerprint-action svg {
  width: 72px;
  height: 72px;
  stroke: var(--text-muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.fingerprint-action span { font-size: clamp(19px, 5vw, 24px); }
.unlock-switch {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: max(54px, calc(30px + env(safe-area-inset-bottom)));
  border: 0;
  background: transparent;
  color: var(--accent-light);
  font: inherit;
  font-size: clamp(17px, 4.5vw, 22px);
  line-height: 1.3;
  text-align: center;
  cursor: pointer;
}
.unlock-switch:active { opacity: .72; }

.pin-copy { padding-top: clamp(82px, 13vh, 140px); }
.pin-boxes {
  width: calc(100% - 48px);
  max-width: 430px;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(9px, 3vw, 18px);
  margin-top: clamp(76px, 11vh, 116px);
}
.pin-box {
  height: clamp(58px, 13vw, 72px);
  border: 1.5px solid var(--text-muted);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  font-size: clamp(22px, 6vw, 30px);
  line-height: 1;
}
.pin-box.filled { border-color: var(--text); }
.pin-error {
  min-height: 19px;
  margin-top: 14px;
  color: var(--error);
  font-size: 14px;
  text-align: center;
}
.pin-boxes.shake { animation: pinShake .35s ease; }
@keyframes pinShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-9px); }
  75% { transform: translateX(9px); }
}
.pin-switch {
  bottom: max(350px, calc(326px + env(safe-area-inset-bottom)));
}
.pin-keypad {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px 14px;
  padding: 24px 20px max(22px, env(safe-area-inset-bottom));
  background: var(--keypad);
  border-top: 1px solid var(--border);
}
.pin-keypad button {
  height: 62px;
  border: 0;
  border-radius: 5px;
  background: var(--keypad-key);
  color: var(--text);
  font: inherit;
  font-size: 29px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s, transform .12s;
}
.pin-keypad button:active {
  background: var(--keypad-key-active);
  transform: scale(.97);
}
.pin-keypad .key-delete { background: transparent; }
.key-delete svg {
  width: 38px;
  height: 28px;
  stroke: var(--text);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-height: 700px) {
  .unlock-copy { padding-top: 64px; }
  .fingerprint-action { margin-top: 72px; }
  .pin-copy { padding-top: 44px; }
  .pin-copy p { margin-top: 15px; }
  .pin-boxes { margin-top: 42px; }
  .pin-switch { bottom: max(318px, calc(294px + env(safe-area-inset-bottom))); }
  .pin-keypad { gap: 8px 12px; padding-top: 14px; }
  .pin-keypad button { height: 55px; }
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 90px;
  background: var(--surface);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes rowIn { from { opacity: 0; transform: translateY(10px);} to {opacity:1; transform: none;} }
@keyframes shimmer { 0% { background-position: -200px 0;} 100% { background-position: 200px 0;} }
@keyframes spin { to { transform: rotate(360deg);} }
@keyframes pulse { 0%,100% {opacity:1} 50% {opacity:.5} }

/* Topbar */
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px 8px;
  position: relative;
}
.icon-btn {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text);
}
button.icon-btn {
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  font: inherit;
}
.icon-btn svg { width: 22px; height: 22px; }
.notif-badge {
  position: absolute; top: 2px; right: 2px;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: #ff3b30; color: #fff; border-radius: 999px;
  font-size: 11px; font-weight: 700; line-height: 18px;
  text-align: center; pointer-events: none;
}
.wallet-name {
  flex: 1; text-align: center;
  font-size: 17px; font-weight: 600;
  display: inline-flex; justify-content: center; align-items: center; gap: 4px;
  color: var(--text);
}
.wallet-name .chev { width: 14px; height: 14px; color: var(--text-muted); }
.wallet-name .divider { color: var(--border); margin: 0 4px; font-weight: 500; }
.wallet-name .copy { width: 14px; height: 14px; color: var(--text-muted); }
.copy-btn { background: transparent; border: 0; padding: 0; margin: 0; cursor: pointer; display: inline-flex; align-items: center; color: inherit; }
.icon-btn.scan svg { width: 24px; height: 24px; }

/* Tabs */
.tabs {
  display: flex; justify-content: space-around;
  padding: 8px 20px 6px;
  position: relative;
}
.tab {
  padding: 10px 0;
  font-size: 17px;
  color: var(--text-muted);
  font-weight: 500;
  transition: color .25s ease;
  cursor: pointer;
  position: relative;
}
.tab.active {
  color: var(--text); font-weight: 700;
}
.tab.active::after {
  content:'';
  position: absolute;
  bottom: 0; left: 20%; right: 20%;
  height: 3px; border-radius: 2px;
  background: linear-gradient(90deg,var(--accent-light),#5a89ff);
  animation: fadeIn .3s;
}

/* Balance */
.balance { text-align: center; padding: 26px 0 20px; }
.balance-label {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-secondary); font-size: 14px;
}
.balance-label svg { width: 15px; height: 15px; }
.balance-amount {
  font-size: 40px; font-weight: 700; margin-top: 8px;
  letter-spacing: -.5px;
  color: var(--text);
}
.balance-btc { color: var(--text-secondary); margin-top: 4px; font-size: 15px; font-weight: 500; }
.balance-change { color: var(--text-secondary); margin-top: 2px; font-size: 14px; }
.balance-change .up { color: var(--green); font-weight: 600; }
.balance-change .down { color: var(--red); font-weight: 600; }
body.light .balance-change .up { color: #16a34a; }
body.light .balance-change .down { color: #dc2626; }

/* Actions */
.actions {
  display: flex; justify-content: space-around;
  padding: 6px 12px 18px;
}
.action-btn {
  background: transparent; border: none; color: var(--text);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: transform .2s cubic-bezier(.2,.9,.3,1.2);
}
.action-btn:active { transform: scale(.92); }
.circle {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--input);
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
}
.circle svg { width: 22px; height: 22px; }
.circle.sm { width: 44px; height: 44px; }

/* Search */
.search-row {
  display: flex; gap: 8px;
  padding: 6px 16px 12px;
  align-items: center;
}
.search {
  flex: 1;
  background: var(--input);
  border-radius: 4px;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
}
.search svg { width: 16px; height: 16px; color: var(--text-muted); }
.search input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-size: 15px;
}
.search input::placeholder { color: var(--text-muted); }
.filter {
  background: var(--input); border-radius: 4px;
  padding: 10px 12px; font-size: 14px;
  display: flex; align-items: center; gap: 4px;
  color: var(--text-secondary);
}
.filter svg { width: 14px; height: 14px; }
.filter.dots svg { width: 18px; height: 18px; }

/* Coin list */
.coin-list { padding: 0 12px; display: flex; flex-direction: column; gap: 8px; }
.coin-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 12px;
  background: var(--surface-elevated);
  border-radius: 4px;
  animation: rowIn .35s ease both;
  transition: background .2s, transform .15s;
  cursor: pointer;
}
.coin-row:active { transform: scale(.985); background: var(--card); }
.coin-icon {
  position: relative;
  width: 38px; height: 38px; border-radius: 50%;
  background: transparent; overflow: visible;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-weight: 700; color: #fff;
  font-size: 14px;
}
.coin-icon > img:first-child { width: 100%; height: 100%; object-fit: contain; }
.coin-icon .network-badge {
  position: absolute; right: -2px; bottom: -2px;
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid var(--bg); background: #fff; object-fit: contain;
}
.coin-main { flex: 1; min-width: 0; }
.coin-name { font-size: 16px; font-weight: 600; color: var(--text); }
.coin-price { font-size: 13px; color: var(--text-secondary); margin-top: 3px; }
.coin-price .chg { margin-left: 6px; font-weight: 500; }
.red { color: var(--red); }
.green { color: var(--green); }
.coin-right { text-align: right; }
.coin-qty { font-weight: 600; font-size: 15px; color: var(--text); }
.coin-usd { color: var(--text-secondary); font-size: 13px; margin-top: 3px; }

/* Skeleton */
.skeleton {
  height: 66px; border-radius: 4px;
  background: linear-gradient(90deg,var(--surface-elevated) 0%,var(--card) 50%,var(--surface-elevated) 100%);
  background-size: 400px 100%;
  animation: shimmer 1.4s infinite linear;
}

/* Transaction skeleton — line style, no background box */
.tx-skel { display: flex; flex-direction: column; gap: 22px; padding: 18px 16px 8px; }
.tx-skel-row { display: flex; align-items: center; gap: 14px; background: transparent; }
.tx-skel-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(90deg,var(--surface-elevated) 0%,var(--input) 50%,var(--surface-elevated) 100%);
  background-size: 400px 100%;
  animation: shimmer 1.4s infinite linear;
  flex-shrink: 0;
}
.tx-skel-lines { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.tx-skel-line {
  display: block; height: 10px; border-radius: 4px;
  background: linear-gradient(90deg,var(--surface-elevated) 0%,var(--input) 50%,var(--surface-elevated) 100%);
  background-size: 400px 100%;
  animation: shimmer 1.4s infinite linear;
}
.tx-skel-line.lg { width: 78%; height: 12px; }
.tx-skel-line.md { width: 56%; }
.tx-skel-line.sm { width: 34%; height: 8px; }

/* Action sheet (bottom) */
.action-sheet {
  position: fixed; inset: 0; z-index: 950;
  display: flex; flex-direction: column; justify-content: flex-end;
  max-width: 480px; margin: 0 auto;
  pointer-events: none;
}
.action-sheet[hidden] { display: none; }
.action-sheet-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.45);
  opacity: 0; transition: opacity .2s ease;
  pointer-events: auto;
}
.action-sheet-open .action-sheet-overlay { opacity: 1; }
.action-sheet-content {
  position: relative; z-index: 1;
  background: var(--surface); color: var(--text);
  border-radius: 20px 20px 0 0;
  padding: 10px 16px 28px;
  transform: translateY(100%);
  transition: transform .25s ease;
  pointer-events: auto;
  max-height: 88vh; overflow-y: auto;
}
.action-sheet-open .action-sheet-content { transform: translateY(0); }
.action-sheet-handle {
  width: 40px; height: 4px; border-radius: 2px;
  background: var(--border); margin: 0 auto 14px;
}
.action-sheet-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.action-sheet-title { font-size: 18px; font-weight: 700; color: var(--text); }
.action-sheet-back {
  width: 28px; height: 28px; border-radius: 50%;
  border: 0; background: var(--input); color: var(--text);
  font-size: 20px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.action-sheet-body { display: flex; flex-direction: column; gap: 12px; }
.action-sheet-body .action-form-label { font-size: 13px; color: var(--text-secondary); }
.action-sheet-body .action-form-input {
  background: var(--input); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; font-size: 15px; outline: none;
}
.action-sheet-body .action-form-select {
  background: var(--input); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; font-size: 15px; outline: none;
}
.action-sheet-body .action-form-btn {
  background: var(--accent); color: #fff; border: 0; border-radius: 12px;
  padding: 14px; font-size: 16px; font-weight: 600; cursor: pointer; margin-top: 8px;
}
.action-sheet-body .action-form-btn.secondary { background: var(--input); color: var(--text); }
.action-sheet-body .action-msg { font-size: 13px; text-align: center; min-height: 18px; color: var(--text-secondary); }
.action-sheet-body .action-msg.err { color: var(--red); }
.action-sheet-body .action-msg.ok { color: var(--green); }
.action-sheet-body .action-menu-item {
  display: flex; align-items: center; gap: 12px; padding: 14px 0;
  border-bottom: 1px solid var(--border); color: var(--text); cursor: pointer;
}
.action-sheet-body .action-menu-item:last-child { border-bottom: 0; }
.action-sheet-body .action-qr {
  background: #fff; padding: 12px; border-radius: 10px; width: 220px; height: 220px;
  margin: 0 auto; display: flex; align-items: center; justify-content: center;
}
.action-sheet-body .action-qr canvas { display: block; width: 100%; height: 100%; }
.qr-reader {
  width: 100%; max-width: 280px; aspect-ratio: 1 / 1; margin: 0 auto;
  border-radius: 16px; overflow: hidden; border: 2px solid var(--border);
  background: #000; position: relative;
}
.qr-reader video, .qr-reader img {
  width: 100% !important; height: 100% !important; object-fit: cover !important; display: block;
}
.qr-hint { color: var(--text-secondary); font-size: 13px; text-align: center; }
.action-sheet-body .action-address {
  font-family: "SF Mono", ui-monospace, Menlo, monospace; font-size: 14px;
  word-break: break-all; text-align: center; color: var(--text); padding: 0 8px;
}

/* Toast */
.toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: rgba(30,30,30,.95); color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 14px; z-index: 1000; opacity: 0; transition: opacity .2s, transform .2s;
  pointer-events: none; white-space: nowrap;
}
body.light .toast { background: rgba(50,50,50,.95); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Receive modal */
.receive-modal {
  position: fixed; inset: 0; z-index: 900;
  background: var(--surface); color: var(--text);
  max-width: 480px; margin: 0 auto;
  overflow-y: auto;
  padding-bottom: 40px;
  animation: fadeIn .2s ease;
}
.rc-wallet {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--input); border-radius: 8px;
  padding: 8px 14px; margin: 4px 16px 14px;
  font-size: 14px;
  color: var(--text);
}
.rc-wallet-ic { display: inline-flex; }
.rc-wallet-ic svg { width: 14px; height: 14px; }
.rc-card {
  background: var(--card);
  border-radius: 14px;
  margin: 0 16px;
  padding: 20px 18px 18px;
  display: flex; flex-direction: column; align-items: center;
}
.rc-token {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 16px; font-weight: 600;
  padding: 6px 12px;
  margin-bottom: 16px;
  color: var(--text);
}
.rc-token img { width: 22px; height: 22px; border-radius: 50%; }
.rc-token .chev { width: 14px; height: 14px; color: var(--text-muted); }
.rc-qr {
  background: #fff; padding: 14px; border-radius: 8px;
  width: 260px; height: 260px;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.rc-qr canvas, .rc-qr img { display: block; width: 100% !important; height: 100% !important; }
.rc-address {
  margin-top: 16px;
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 14px;
  letter-spacing: .2px;
  text-align: center;
  word-break: break-all;
  line-height: 1.5;
  padding: 0 6px;
  color: var(--text);
}
.rc-address .rc-a-head { color: var(--green); }
.rc-address .rc-a-mid { color: var(--text); }
.rc-address .rc-a-tail { color: var(--accent-light); }
.rc-actions {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  padding: 16px;
}
.rc-warn {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 0 16px;
  padding: 12px 14px;
  background: var(--card);
  border-radius: 10px;
  color: var(--text-secondary); font-size: 12px; line-height: 1.5;
}
.rc-warn svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; color: var(--text-muted); }
.rc-warn b { color: var(--text); font-weight: 600; }
.rc-deposit {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin: 18px 16px 0;
  width: calc(100% - 32px);
}
.rc-deposit svg { width: 18px; height: 18px; }

/* Bottom nav */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  max-width: 480px; margin: 0 auto;
  display: flex; justify-content: space-around;
  padding: 10px 6px 22px;
  background: rgba(10,10,10,.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
}
body.light .bottom-nav { background: rgba(255,255,255,.92); }
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--text-muted); font-size: 11px;
  padding: 4px 10px;
  transition: color .2s, transform .2s;
  cursor: pointer;
}
.nav-item svg { width: 22px; height: 22px; }
.nav-item.active { color: var(--green); }
.nav-item:active { transform: scale(.9); }

/* PNG nav icons */
.nav-icon { width: 52px; height: 36px; object-fit: contain; display: block; }
.nav-icon-active { display: none; }
.nav-item.active .nav-icon-inactive { display: none; }
.nav-item.active .nav-icon-active { display: block; }

/* Dark theme (default) — inactive icons grey, active green */
.nav-icon-inactive { filter: brightness(0) invert(1) opacity(0.45); }
.nav-icon-active { filter: none; }

/* Light/day theme — inactive icons dark grey, active green */
body.light .nav-icon-inactive { filter: brightness(0) opacity(0.55); }
body.light .nav-icon-active { filter: none; }

/* Ripple */
.ripple { position: relative; overflow: hidden; }
.ripple .rp {
  position: absolute; border-radius: 50%;
  background: rgba(255,255,255,.15);
  transform: scale(0);
  animation: rippleAnim .55s ease-out;
  pointer-events: none;
}
@keyframes rippleAnim { to { transform: scale(4); opacity: 0; } }

/* ==== Detail page (USDT) ==== */
.detail-header {
  display: flex; align-items: center;
  padding: 14px 16px 8px;
  gap: 8px;
}
.detail-header .back {
  color: var(--text); display: flex; padding: 6px;
  background: transparent; border: 0; cursor: pointer;
  font: inherit;
}
.detail-header .back svg { width: 22px; height: 22px; }
.detail-header .title { flex: 1; text-align: center; font-size: 17px; font-weight: 700; color: var(--text); }
.detail-header .header-actions { display: flex; gap: 12px; align-items: center; }
.detail-header .icon { width: 20px; height: 20px; color: var(--text-secondary); }

/* Full-page loading skeleton overlay */
.page-skel {
  position: fixed; inset: 0; z-index: 500;
  background: var(--surface);
  max-width: 480px; margin: 0 auto;
  padding: 16px;
  display: flex; flex-direction: column; gap: 14px;
  overflow: hidden;
}
.ps-bar {
  background: linear-gradient(90deg,var(--surface-elevated) 0%,var(--card) 50%,var(--surface-elevated) 100%);
  background-size: 400px 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: 6px;
}
.ps-row { display: flex; align-items: center; gap: 12px; }
.ps-circle {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(90deg,var(--surface-elevated) 0%,var(--card) 50%,var(--surface-elevated) 100%);
  background-size: 400px 100%;
  animation: shimmer 1.4s infinite linear;
  flex-shrink: 0;
}
.ps-lines { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.ps-actions { display: flex; justify-content: space-around; padding: 14px 0; }
.ps-actions .ps-circle { width: 46px; height: 46px; }


.wallet-meta {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px 4px;
  color: var(--text-secondary); font-size: 13px;
}
.mini-wallet {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--input); border-radius: 5px;
  padding: 6px 12px; color: var(--text);
}
.mini-wallet svg { width: 14px; height: 14px; }
.addr {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-secondary);
}
.addr svg { width: 14px; height: 14px; }

.usdt-balance {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 16px 20px;
}
.usdt-logo { position: relative; width: 52px; height: 52px; flex-shrink: 0; }
.tether-image { width: 52px; height: 52px; display: block; border-radius: 50%; }
.tether {
  width: 52px; height: 52px;
  background: linear-gradient(135deg,#26a69a,#1a7f74);
  clip-path: polygon(50% 0, 100% 30%, 100% 70%, 50% 100%, 0 70%, 0 30%);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 26px;
}
.chain-badge {
  position: absolute; right: -4px; bottom: -2px;
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; color: #eb0029;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  border: 2px solid var(--surface);
}
.chain-badge.network-image {
  display: block;
  padding: 0;
  background: #111;
  object-fit: cover;
}
.usdt-qty { font-size: 34px; font-weight: 700; line-height: 1; color: var(--text); }
.usdt-sub { color: var(--text-secondary); font-size: 13px; margin-top: 6px; }

.grid-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px 4px;
  padding: 4px 12px 16px;
}
.ga {
  background: none; border: none; color: var(--text);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 12px; line-height: 1.2;
  cursor: pointer;
  transition: transform .2s;
}
.ga:active { transform: scale(.92); }

.sub-tabs {
  display: flex; gap: 24px;
  padding: 8px 20px 4px;
  border-bottom: 1px solid var(--border);
}
.stab {
  padding: 10px 0;
  color: var(--text-muted); font-weight: 500; font-size: 15px;
  position: relative;
  cursor: pointer;
}
.stab.active { color: var(--text); font-weight: 700; }
.stab.active::after {
  content: ''; position: absolute; bottom: -1px; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg,var(--accent-light),#5a89ff);
  border-radius: 2px;
}

.chips {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 16px 6px;
  overflow-x: auto;
}
.chip {
  padding: 8px 16px;
  border-radius: 20px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary); font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  transition: all .2s;
}
.chip.active {
  background: var(--accent); color: #fff; border-color: transparent;
}
.chip-icon {
  margin-left: auto;
  color: var(--text-muted);
}
.chip-icon svg { width: 20px; height: 20px; }

.tx-list { padding: 4px 16px; display: flex; flex-direction: column; gap: 4px; }
.tx-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--border);
  animation: rowIn .4s ease both;
}
.tx-ic {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--input);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.tx-ic svg { width: 18px; height: 18px; }
.tx-ic.recv { color: var(--green); }
.tx-ic.send { color: var(--accent-light); }
.tx-info { flex: 1; min-width: 0; }
.tx-type { font-weight: 600; font-size: 15px; color: var(--text); }
.tx-addr { color: var(--text-muted); font-size: 12px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-right { text-align: right; }
.tx-amt { font-weight: 600; font-size: 14px; color: var(--text); }
.tx-amt.send { color: var(--red); }
.tx-date { color: var(--text-muted); font-size: 12px; margin-top: 3px; }

.explorer-link {
  display: block; text-align: center;
  color: var(--accent-light); font-size: 14px;
  padding: 20px 0;
  text-decoration: none;
}

.bottom-actions {
  position: fixed; bottom: 0; left: 0; right: 0;
  max-width: 480px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  padding: 12px 16px 24px;
  background: rgba(10,10,10,.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
}
body.light .bottom-actions { background: rgba(255,255,255,.95); }
.btn {
  padding: 14px;
  border-radius: 6px;
  font-size: 16px; font-weight: 600;
  border: none; cursor: pointer;
  transition: transform .15s, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn.outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn.primary { background: var(--accent); color: #fff; }

.app.detail { padding-bottom: 100px; }

/* Loading spinner */
.spinner {
  width: 22px; height: 22px;
  border: 2.5px solid rgba(255,255,255,.15);
  border-top-color: var(--accent-light);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 20px auto;
}
body.light .spinner {
  border-color: rgba(0,0,0,.15);
  border-top-color: var(--accent-light);
}

/* ==== Admin panel ==== */
.admin-panel {
  position: fixed; inset: 0; z-index: 2000;
  background: var(--surface); color: var(--text);
}
.admin-header {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; gap: 12px;
  padding: 18px 16px 14px; background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.admin-close {
  background: transparent; border: 0; color: var(--text); padding: 6px; cursor: pointer;
  display: flex; align-items: center;
}
.admin-close svg { width: 22px; height: 22px; }
.admin-title { font-size: 18px; font-weight: 600; color: var(--text); }
.admin-msg { min-height: 22px; padding: 4px 20px; font-size: 13px; }
.admin-msg.ok { color: #4ade80; }
.admin-msg.err { color: var(--error); }
.admin-section {
  margin: 14px 16px; padding: 16px;
  background: var(--card); border-radius: 14px;
}
.admin-section-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; color: var(--text); }
.admin-subsection-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.admin-total { font-size: 30px; font-weight: 700; letter-spacing: 0.5px; color: var(--text); }
.admin-hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.admin-label {
  display: block; font-size: 12px; color: var(--text-muted);
  margin: 10px 0 6px; text-transform: uppercase; letter-spacing: 0.5px;
}
.admin-input {
  width: 100%; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-size: 15px; font-family: inherit;
  outline: none; -webkit-appearance: none; appearance: none;
}
.admin-input:focus { border-color: var(--accent-light); }
select.admin-input {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8794' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
  padding-right: 40px;
}
body.light select.admin-input {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>");
}
.admin-btn {
  width: 100%; margin-top: 14px; padding: 13px;
  border: 0; border-radius: 10px; cursor: pointer;
  font-size: 15px; font-weight: 600; font-family: inherit;
}
.admin-btn.primary { background: var(--accent-light); color: #fff; }
.admin-btn.primary:active { background: #5a48d9; }
.admin-btn.outline {
  background: transparent; color: var(--text); border: 1px solid var(--border);
}
.admin-qr-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 8px 0 14px; padding: 12px; border: 1px dashed var(--border); border-radius: 12px; background: rgba(255,255,255,.03); }
body.light .admin-qr-wrap { background: rgba(0,0,0,.03); }
.admin-qr-label { font-size: 12px; color: var(--text-secondary); }
.admin-qr-canvas { width: 180px; height: 180px; border-radius: 10px; background: #fff; }
.admin-qr-custom-label { font-size: 12px; color: var(--accent); }
.admin-row { display: flex; gap: 10px; }
.admin-row .admin-btn { flex: 1; }
.admin-subform {
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--border);
}
.admin-tx-list { margin: 4px 0 6px; display: flex; flex-direction: column; gap: 8px; }
.admin-tx {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; background: var(--surface); border-radius: 10px;
}
.admin-tx-top { font-size: 14px; font-weight: 600; color: var(--text); }
.admin-tx-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.admin-tx-actions {
  display: flex; align-items: center; gap: 4px;
}
.admin-edit {
  background: transparent; border: 0; color: var(--text-muted);
  cursor: pointer; padding: 4px 6px; display: flex; align-items: center;
  transition: color .15s;
}
.admin-edit:hover { color: var(--accent-light); }
.admin-edit svg { width: 16px; height: 16px; }
.admin-del {
  background: transparent; border: 0; color: var(--error);
  font-size: 22px; line-height: 1; cursor: pointer; padding: 4px 8px;
}
.admin-empty { padding: 12px; text-align: center; color: var(--text-muted); font-size: 13px; }
.admin-gap-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.admin-gap-between { color: var(--text-muted); font-size: 13px; white-space: nowrap; }
.admin-gap-input { flex: 1; min-width: 0; }
.admin-skel {
  height: 46px; border-radius: 10px;
  background: linear-gradient(90deg, var(--surface-elevated), var(--input), var(--surface-elevated));
  background-size: 200% 100%; animation: adminShimmer 1.2s infinite;
}
@keyframes adminShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.tx-empty { padding: 30px 16px; text-align: center; color: var(--text-muted); font-size: 14px; }

/* ---------- Swap page ---------- */
.app.swap { padding-bottom: 90px; }
.swap-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
}
.wallet-selector {
  display: flex; align-items: center; gap: 6px;
  font-size: 18px; font-weight: 700;
}
.wallet-selector .chev { width: 16px; height: 16px; color: var(--text-muted); }
.swap-header .icon-btn { color: var(--text); }
.swap-header .icon-btn svg { width: 22px; height: 22px; }

.swap-tabs {
  display: flex; align-items: center; justify-content: center;
  gap: 28px; padding: 0 16px 12px;
  border-bottom: 1px solid var(--border);
}
.swap-tab {
  position: relative; padding: 10px 4px;
  font-size: 16px; font-weight: 600; color: var(--text-muted);
  cursor: pointer;
}
.swap-tab.active { color: var(--text); }
.swap-tab.active::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px;
  height: 3px; background: var(--accent-light); border-radius: 3px 3px 0 0;
}

.swap-card {
  margin: 14px 16px 0; padding: 16px;
  background: var(--surface-elevated); border: 1px solid var(--border);
  border-radius: 16px;
}
.swap-card-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.swap-label { font-size: 16px; font-weight: 700; color: var(--text); }
.swap-balance {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-muted);
}
.swap-balance svg { width: 14px; height: 14px; }
.swap-max { color: var(--accent-light); font-weight: 700; cursor: pointer; }
.swap-token-row {
  display: flex; align-items: center; justify-content: space-between;
}
.swap-token {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer;
}
.swap-token-icon-wrap { position: relative; width: 34px; height: 34px; flex-shrink: 0; }
.swap-token-icon { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.swap-token-badge {
  position: absolute; right: -2px; bottom: -2px;
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid var(--bg); background: #fff; object-fit: contain;
}
.swap-token-info { display: flex; flex-direction: column; }
.swap-token-symbol { font-size: 16px; font-weight: 700; color: var(--text); }
.swap-token-network { font-size: 12px; color: var(--text-muted); }
.swap-token .chev { width: 16px; height: 16px; color: var(--text-muted); margin-left: 4px; }
.swap-amount-input {
  background: transparent; border: 0; outline: 0;
  font-size: 20px; font-weight: 600; color: var(--text);
  text-align: right; width: 50%;
}
.swap-amount-input::placeholder { color: var(--text-muted); opacity: 0.5; }
.swap-amount-received {
  font-size: 20px; font-weight: 600; color: var(--text-muted);
}

.swap-flip {
  width: 42px; height: 42px; margin: -10px auto -10px;
  display: flex; align-items: center; justify-content: center;
  background: #1f1f24; border: 4px solid var(--surface); border-radius: 50%;
  color: var(--text); z-index: 2; position: relative;
}
.swap-flip svg { width: 20px; height: 20px; }
body.light .swap-flip { border-color: var(--surface); background: #e8e8eb; }

.swap-action-btn {
  margin: 20px 16px 0; width: calc(100% - 32px); padding: 16px;
  background: var(--surface-elevated); color: var(--text); border: 1px solid var(--border);
  border-radius: 12px; font-size: 16px; font-weight: 700; cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.swap-action-btn.ready {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff; border-color: transparent;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}
.swap-action-btn.ready:active { background: linear-gradient(135deg, #4f46e5, #7c3aed); }

.swap-details {
  margin: 14px 16px 0; padding: 14px 16px;
  background: var(--surface-elevated); border: 1px solid var(--border);
  border-radius: 16px;
}
.swap-detail-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0; font-size: 14px;
}
.swap-detail-row:first-child { padding-top: 0; }
.swap-detail-row:last-child { padding-bottom: 0; }
.swap-detail-row.detail-collapsed { display: none; }
.swap-details.expanded .swap-detail-row.detail-collapsed { display: flex; }
.swap-detail-label { color: var(--text-muted); font-weight: 600; }
.swap-detail-value {
  display: flex; align-items: center; gap: 6px;
  color: var(--text); font-weight: 600;
}
.swap-detail-value .chev { width: 14px; height: 14px; color: var(--text-muted); margin-left: 2px; }
.swap-provider-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent-light);
}
.swap-provider-icon {
  width: 20px; height: 20px; border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.swap-provider-icon svg { width: 12px; height: 12px; }

.swap-show-more {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  margin: 12px auto; padding: 6px 12px;
  background: transparent; border: 0; color: var(--text-muted); font-size: 13px; font-weight: 600; cursor: pointer;
}
.swap-show-more svg { width: 14px; height: 14px; transition: transform 0.2s ease; }
.swap-show-more.expanded svg { transform: rotate(180deg); }

.swap-disclaimer {
  display: flex; gap: 10px; align-items: flex-start;
  margin: 0 16px 20px; padding: 12px;
  background: var(--surface-elevated); border: 1px solid var(--border);
  border-radius: 12px; color: var(--text-muted); font-size: 12px; line-height: 1.5;
}
.swap-disclaimer svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }

.bottom-nav a.nav-item { text-decoration: none; }


/* ===== EARN TAB - Pixel-Perfect Match ===== */
.earn-card {
  margin: 0 12px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
}
body.light .earn-card { box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.earn-equity { margin-top: 16px; }
.earn-equity-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-muted); font-weight: 500; margin-bottom: 8px;
}
.earn-eye { width: 16px; height: 16px; color: var(--text-muted); }
.earn-equity-amount { font-size: 32px; font-weight: 800; color: var(--text); line-height: 1; }
.earn-equity-btc { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.earn-section-title {
  font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 12px;
  display: flex; align-items: center; gap: 6px;
}
.earn-title-icon { width: 18px; height: 18px; color: var(--text); flex-shrink: 0; }
.earn-section-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.5; margin: -4px 0 12px; }

/* Recommend */
.earn-recommend-list { display: flex; gap: 10px; flex-wrap: wrap; }
.earn-recommend-item {
  width: 96px;
  background: var(--input);
  border-radius: 12px;
  padding: 12px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  cursor: pointer;
}
.earn-token-icon {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.earn-token-icon svg { width: 40px; height: 40px; }
.earn-trx-img { width: 36px; height: 36px; object-fit: contain; border-radius: 50%; }
.earn-recommend-apr { font-size: 12px; font-weight: 700; color: #00C853; white-space: nowrap; }
.earn-recommend-apr span { font-weight: 500; color: var(--text-muted); }

.earn-chip-img { width: 16px; height: 16px; object-fit: contain; border-radius: 50%; display: block; }
.earn-multi-icons { display: flex; align-items: center; }
.earn-multi-img {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--card);
  object-fit: cover; background: var(--card); flex-shrink: 0;
}
.earn-multi-img + .earn-multi-img { margin-left: -8px; }

/* Stake chips */
.earn-stake-chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.earn-stake-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 700; cursor: pointer; line-height: 1;
  height: 32px; box-sizing: border-box;
}
.chip-red { background: rgba(255,0,19,0.14); color: #FF0013; }
.chip-blue { background: rgba(76,110,245,0.14); color: #4C6FFF; }
.chip-multi { background: var(--input); color: var(--text); border: 1px solid var(--border); }
body.light .chip-red { background: #FFEBEE; color: #FF0013; }
body.light .chip-blue { background: #E8EAFF; color: #4C6FFF; }
body.light .chip-multi { background: #E8E8EC; border-color: rgba(0,0,0,0.06); }
.earn-chip-icon { display: flex; align-items: center; justify-content: center; width: 16px; height: 16px; }
.earn-chip-icon svg { display: block; width: 16px; height: 16px; }
.earn-multi-icons { display: flex; align-items: center; }
.earn-multi-icon {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--card);
  box-sizing: border-box; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.earn-multi-icon + .earn-multi-icon { margin-left: -8px; }
.earn-multi-icon.eth { background: #627EEA; }
.earn-multi-icon.eth::after { content: "Ξ"; color: #fff; font-size: 10px; font-weight: 800; }
.earn-multi-icon.trx { background: #FF0013; }
.earn-multi-icon.trx::after { content: "▼"; color: #fff; font-size: 8px; font-weight: 800; }
.earn-multi-icon.bnb { background: #F3BA2F; }
.earn-multi-icon.bnb::after { content: "B"; color: #fff; font-size: 10px; font-weight: 800; }
.earn-chip-more { font-size: 14px; color: var(--text-muted); font-weight: 700; margin-left: 2px; }

/* Dapps */
.earn-dapps-list { display: flex; gap: 10px; flex-wrap: wrap; }
.earn-dapp-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
}
.earn-dapp-hex { background: #1a1a2e; border: 2px solid #7c5cff; }
.earn-dapp-hex svg { display: block; }
.earn-dapp-menu { background: #0d0d0d; border: 2px solid #333; color: #fff; }
.earn-dapp-menu svg { display: block; color: #fff; }

/* ===== NFT TAB (matches reference image 2) ===== */
:root { --nft-empty-sheet: #1c1c1e; }
body.light { --nft-empty-sheet: #f0f0f2; }

.nft-chain-row {
  display: flex; gap: 10px; overflow-x: auto;
  padding: 4px 16px 12px;
  scrollbar-width: none; -ms-overflow-style: none;
}
.nft-chain-row::-webkit-scrollbar { display: none; }

.nft-chain {
  width: 42px; height: 42px; border-radius: 50%;
  flex: 0 0 42px;
  background: var(--card);
  border: 2px solid transparent;
  display: flex; align-items: center; justify-content: center;
  padding: 0; cursor: pointer; transition: transform .12s, border-color .12s;
}
.nft-chain:active { transform: scale(.92); }
.nft-chain img { width: 26px; height: 26px; object-fit: contain; }
.nft-chain.active { border-color: var(--accent-light); background: var(--card); }
.nft-chain.fallback { font-size: 11px; font-weight: 700; color: #fff; }
.nft-chain.eth-fallback { background: #627eea; }
.nft-chain.eth-fallback::after { content: "E"; }
.nft-chain.pol-fallback { background: #8247e5; }
.nft-chain.pol-fallback::after { content: "P"; }
.nft-chain.arb-fallback { background: #12aaff; }
.nft-chain.arb-fallback::after { content: "A"; }
.nft-chain.op-fallback { background: #ff0420; }
.nft-chain.op-fallback::after { content: "O"; }
.nft-chain.sol-fallback { background: #9945ff; }
.nft-chain.sol-fallback::after { content: "S"; }
.nft-chain.btc-fallback { background: #f7931a; }
.nft-chain.btc-fallback::after { content: "B"; }
.nft-chain.sfp-fallback { background: #3375bb; }
.nft-chain.sfp-fallback::after { content: "S"; }

.nft-search-row {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 16px 12px;
}
.nft-search {
  flex: 1;
  background: var(--input);
  border-radius: 6px;
  display: flex; align-items: center; gap: 8px;
  padding: 11px 12px;
}
.nft-search svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.nft-search input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-size: 15px;
}
.nft-search input::placeholder { color: var(--text-muted); }
.nft-receive-btn {
  height: 42px; padding: 0 18px; border-radius: 6px;
  background: var(--input); border: 0;
  color: var(--text); font-size: 15px; font-weight: 600;
  cursor: pointer; flex-shrink: 0;
}
.nft-more-btn {
  width: 42px; height: 42px; border-radius: 6px;
  background: var(--input); border: 0; color: var(--text);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
}
.nft-more-btn svg { width: 18px; height: 18px; color: var(--text-secondary); }

.nft-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 72px 24px 40px;
  text-align: center;
}
.nft-empty-icon { width: 80px; height: 80px; color: var(--text-muted); }
.nft-empty-icon svg { width: 100%; height: 100%; display: block; }
.nft-empty-text {
  margin-top: 18px; font-size: 15px; font-weight: 600; color: var(--text-secondary);
}

/* NFT collection grid in frontend */
.nft-collection {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 4px 16px 16px;
}
.nft-collection:empty + .nft-empty,
.nft-collection:not(:empty) + .nft-empty { display: none; }
.nft-card {
  background: var(--card);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  transition: transform .15s;
}
.nft-card:active { transform: scale(.97); }
.nft-card-img {
  width: 100%; aspect-ratio: 1 / 1;
  object-fit: cover; background: var(--input);
  display: block;
}
.nft-card-img svg { width: 100%; height: 100%; display: block; }
.nft-card-info {
  padding: 10px 12px;
}
.nft-card-name {
  font-size: 14px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nft-card-chain {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 6px; font-size: 12px; color: var(--text-secondary);
}
.nft-card-chain img {
  width: 14px; height: 14px; border-radius: 50%; object-fit: contain;
}
.nft-card-price {
  margin-top: 6px; font-size: 13px; font-weight: 700; color: var(--accent-light);
}

/* ===== New Admin Panel (sidebar layout) ===== */
.admin-layout {
  display: flex; height: 100%;
  background: var(--surface); color: var(--text);
}

.admin-sidebar {
  width: 76px; flex: 0 0 76px;
  display: flex; flex-direction: column;
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 16px 0 12px;
  overflow-y: auto;
}
.admin-sidebar-header {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding-bottom: 18px; margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.admin-sidebar-logo {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--accent-light); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700;
}
.admin-sidebar-title {
  font-size: 11px; font-weight: 600; color: var(--text-secondary);
}

.admin-nav {
  flex: 1; display: flex; flex-direction: column; gap: 4px;
  padding: 0 8px;
}
.admin-nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 10px 4px; border-radius: 10px;
  background: transparent; border: 0; color: var(--text-muted);
  font-size: 10px; font-weight: 600; cursor: pointer;
  transition: all .15s;
}
.admin-nav-item svg { width: 20px; height: 20px; }
.admin-nav-item.active {
  background: var(--input); color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border);
}
.admin-nav-item.active svg { color: var(--accent-light); }
.admin-nav-item:active { transform: scale(.95); }

.admin-close {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  margin-top: 8px; padding: 12px 4px;
  background: transparent; border: 0; color: var(--text-muted);
  font-size: 10px; font-weight: 600; cursor: pointer;
}
.admin-close svg { width: 20px; height: 20px; }

.admin-main {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.admin-main-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; background: var(--surface);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.admin-menu-toggle {
  display: none; width: 34px; height: 34px;
  background: transparent; border: 0; color: var(--text); padding: 0;
  align-items: center; justify-content: center;
}
.admin-menu-toggle svg { width: 22px; height: 22px; }
.admin-main-title { font-size: 18px; font-weight: 700; color: var(--text); }

.admin-content {
  flex: 1; overflow-y: auto; padding: 12px 0 24px;
}
.admin-view { display: none; animation: fadeIn .2s ease; }
.admin-view.active { display: block; }

.admin-card {
  margin: 12px 14px; padding: 16px;
  background: var(--card); border-radius: 14px;
  border: 1px solid var(--border);
}
.admin-card.stat { padding: 20px 16px; }
.admin-card-label {
  font-size: 12px; font-weight: 600; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px;
}

.admin-quick-actions {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.admin-quick {
  padding: 12px; border-radius: 10px;
  background: var(--input); border: 1px solid var(--border);
  color: var(--text); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: transform .1s;
}
.admin-quick:active { transform: scale(.97); }

/* NFT grid in admin */
.admin-nft-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.admin-nft-item {
  position: relative; border-radius: 12px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  cursor: pointer; transition: transform .12s;
}
.admin-nft-item:active { transform: scale(.96); }
.admin-nft-item.added { opacity: .55; }
.admin-nft-thumb {
  width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block;
  background: var(--input);
}
.admin-nft-name {
  padding: 8px 10px 2px; font-size: 11px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.admin-nft-price {
  padding: 0 10px 8px; font-size: 11px; font-weight: 700; color: var(--accent-light);
}
.admin-nft-add {
  position: absolute; top: 6px; right: 6px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent-light); color: #fff; border: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; line-height: 1; cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
}
.admin-nft-add svg { width: 14px; height: 14px; }
.admin-nft-item.added .admin-nft-add {
  background: var(--green); pointer-events: none;
}
.admin-nft-added {
  display: flex; gap: 10px; overflow-x: auto; padding: 4px 0 8px;
}
.admin-nft-added:empty { display: none; }
.admin-nft-added-item {
  position: relative; flex: 0 0 64px;
}
.admin-nft-added .admin-nft-thumb {
  width: 64px; height: 64px; border-radius: 10px; flex: 0 0 64px;
}
.admin-nft-added-price {
  position: absolute; bottom: 4px; left: 2px; right: 2px;
  text-align: center; font-size: 9px; font-weight: 700; color: #fff;
  background: rgba(0,0,0,.55); border-radius: 4px; padding: 1px 0;
}

.admin-theme-card {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px; background: var(--input); border-radius: 12px;
}
.admin-theme-label { font-size: 15px; font-weight: 600; color: var(--text); }
.admin-theme-toggle {
  padding: 8px 14px; border-radius: 8px;
  background: var(--accent-light); color: #fff; border: 0;
  font-size: 13px; font-weight: 600; cursor: pointer;
}

@media (max-width: 480px) {
  .admin-sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 2002;
    width: 220px; transform: translateX(-100%);
    transition: transform .25s ease; padding-top: 12px;
  }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-sidebar-overlay {
    position: fixed; inset: 0; z-index: 2001;
    background: rgba(0,0,0,.5); opacity: 0; pointer-events: none;
    transition: opacity .25s;
  }
  .admin-sidebar-overlay.open { opacity: 1; pointer-events: auto; }
  .admin-sidebar-header { flex-direction: row; padding: 10px 16px 14px; }
  .admin-nav { padding: 0 12px; }
  .admin-nav-item {
    flex-direction: row; justify-content: flex-start; gap: 12px;
    padding: 12px; font-size: 14px;
  }
  .admin-close {
    flex-direction: row; justify-content: flex-start; gap: 12px;
    padding: 12px; margin: 0 12px; font-size: 14px;
  }
  .admin-menu-toggle { display: flex; }
  .admin-nft-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Edit token modal */
.admin-modal-overlay {
  position: fixed; inset: 0; z-index: 2003;
  background: rgba(0,0,0,.5);
}
.admin-modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  z-index: 2004; width: calc(100% - 48px); max-width: 380px;
  background: var(--card); border-radius: 16px;
  padding: 20px; box-shadow: 0 8px 32px rgba(0,0,0,.3);
  max-height: 80vh; overflow-y: auto;
}
.admin-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.admin-modal-title { font-size: 18px; font-weight: 700; color: var(--text); }
.admin-modal-close {
  background: transparent; border: 0; color: var(--text-muted);
  font-size: 24px; cursor: pointer; padding: 4px; line-height: 1;
}
.admin-modal .admin-label { margin-top: 12px; }
.admin-modal .admin-label:first-of-type { margin-top: 0; }
.admin-modal .admin-btn { margin-top: 16px; }

/* Hide old admin styles that conflict with new layout */
.admin-panel .admin-header { display: none; }
.admin-msg { margin-left: auto; min-height: 18px; font-size: 13px; }

/* ===== Multi-User System ===== */
.master-only { /* shown by default, hidden for user admins via JS */ }
#adminHeaderUser {
  font-size: 12px;
  color: var(--accent-light);
  font-weight: 500;
  padding: 2px 0 6px;
}
#adminKeyInput:focus {
  outline: none;
  border-color: var(--accent-light);
}
