/* ========================================================
   Garden Bot Mini App — style.css
   Premium dark luxury design · Mobile-first · 360px baseline
   Telegram Mini App safe-area aware
   ======================================================== */

/* ── Design tokens ─────────────────────────────────────── */
:root {
  /* Base palette — aligned to WEB tokens (garden-design-system.md / tailwind.config):
     ink-900 #050505 (page bg), ink-800 #0a0f0b, ink-700 #121814 */
  --bg:             #050505;
  --bg-secondary:   #0a0f0b;
  --bg-elevated:    #121814;
  --bg-surface:     rgba(255,255,255,0.045);
  --bg-surface-2:   rgba(255,255,255,0.07);

  /* Text hierarchy — web body #E5E7EB, muted #A1A1AA */
  --text:           #E5E7EB;
  --text-secondary: #A1A1AA;
  --hint:           #6B7280;
  --link:           #00C46A;

  /* Garden brand green — web emerald #00C46A, dark #006B3C, gradient tip #00e07a */
  --green:          #00C46A;
  --green-bright:   #00e07a;
  --green-dim:      #006B3C;
  --green-glow:     rgba(0,196,106,0.18);
  --green-glow-sm:  rgba(0,196,106,0.10);

  /* Refined gold accent — web gold #D4AF37, light #F5D76E */
  --gold:           #D4AF37;
  --gold-bright:    #F5D76E;
  --gold-dim:       #A88A20;
  --gold-glow:      rgba(212,175,55,0.35);

  /* Semantic — web red #C8341B, deep #9E1B1B, warn #F59E0B */
  --danger:         #C8341B;
  --danger-bright:  #E05454;
  --danger-dim:     rgba(200,52,27,0.12);
  --danger-border:  rgba(200,52,27,0.34);
  --caution-dim:    rgba(245,158,11,0.11);
  --caution-border: rgba(245,158,11,0.34);

  /* Borders & separators */
  --border:         rgba(255,255,255,0.07);
  --border-strong:  rgba(255,255,255,0.12);
  --separator:      rgba(255,255,255,0.06);

  /* Cards */
  --card-bg:        rgba(255,255,255,0.04);
  --card-border:    rgba(255,255,255,0.08);
  --card-shadow-sm: 0 2px 12px rgba(0,0,0,0.24);

  /* Radius */
  --radius:    20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --radius-pill: 100px;

  /* Transitions */
  --ease: cubic-bezier(0.22,1,0.36,1);

  /* Safe areas */
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top:    env(safe-area-inset-top, 0px);
}

/* ── Reduced-motion respect ────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Reset / base ─────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, "SF Pro Display", "SF Pro Text", Inter,
               "PingFang SC", "Microsoft YaHei", "Noto Sans SC",
               "Noto Sans Arabic", system-ui, sans-serif;
  /* Web garden-gradient for brand parity (globals.css :20) */
  background-color: var(--bg);
  background-image: linear-gradient(135deg, #050505 0%, #0a1a10 50%, #050505 100%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--link); text-decoration: none; }

/* ── App shell ────────────────────────────────────────── */
#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ── Screen system ────────────────────────────────────── */
.screen {
  display: none;
  flex-direction: column;
  flex: 1;
  padding-bottom: calc(76px + var(--safe-bottom));
  animation: screen-in 0.18s var(--ease) both;
}
.screen.active { display: flex; }

@keyframes screen-in {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── App header (home) ────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  padding-top: calc(14px + var(--safe-top));
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 9px;
}

.app-logo-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--green) 0%, var(--green-dim) 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 2px 10px var(--green-glow);
  flex-shrink: 0;
}

.app-logo-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
  font-size: 18px;
  line-height: 1;
}
.icon-btn:active { background: var(--bg-surface-2); color: var(--text); }

/* ── Top bar / back header ────────────────────────────── */
.top-bar {
  display: flex;
  align-items: center;
  padding: 12px 14px 10px;
  padding-top: calc(12px + var(--safe-top));
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10,15,12,0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.back-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
  font-size: 22px;
  line-height: 1;
}
.back-btn:active { background: var(--bg-surface-2); color: var(--text); }

.top-bar-title {
  font-size: 16px;
  font-weight: 600;
  flex: 1;
  letter-spacing: -0.01em;
}

/* ── Cards ────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--card-shadow-sm);
  margin: 0 12px 10px;
}

/* ── Hero balance card ────────────────────────────────── */
.balance-card {
  margin: 6px 12px 12px;
  border-radius: var(--radius);
  padding: 24px 20px 22px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, #0E2018 0%, #071409 55%, #040D07 100%);
  border: 1px solid rgba(22,179,100,0.22);
  box-shadow:
    0 0 0 1px rgba(22,179,100,0.07),
    0 8px 40px rgba(0,0,0,0.45),
    inset 0 1px 0 rgba(255,255,255,0.06);
}

.balance-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(ellipse 80% 60% at 100% 0%, rgba(22,179,100,0.11) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 0% 100%, rgba(22,179,100,0.06) 0%, transparent 60%);
  pointer-events: none;
}

.balance-card::after {
  content: '';
  position: absolute;
  top: -60px;
  right: -60px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(22,179,100,0.09) 0%, transparent 70%);
  pointer-events: none;
}

.balance-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
  position: relative;
}

.balance-amount {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.05;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  position: relative;
}

.balance-unit {
  font-size: 19px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-left: 6px;
  letter-spacing: 0;
}

.balance-address-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  background: rgba(0,0,0,0.28);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  border: 1px solid rgba(255,255,255,0.06);
  position: relative;
}

.balance-address {
  font-size: 12px;
  color: var(--text-secondary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: "SF Mono", "Fira Code", ui-monospace, monospace;
  letter-spacing: 0.02em;
}

.copy-btn {
  background: rgba(22,179,100,0.16);
  border: 1px solid rgba(22,179,100,0.28);
  border-radius: var(--radius-xs);
  color: var(--green-bright);
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  min-height: 30px;
  min-width: 48px;
  transition: background 0.15s;
}
.copy-btn:active { background: rgba(22,179,100,0.28); }

.tier-next {
  font-size: 11px;
  opacity: 0.78;
  margin-top: 6px;
  color: var(--text-secondary);
}

.tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius-pill);
  padding: 5px 12px 5px 8px;
  font-size: 12px;
  font-weight: 600;
  margin-top: 14px;
  position: relative;
  letter-spacing: 0.01em;
}

.tier-badge.tier-seed   { background: rgba(90,110,96,0.2);   border: 1px solid rgba(90,110,96,0.3);    color: var(--text-secondary); }
.tier-badge.tier-sprout { background: rgba(22,179,100,0.12); border: 1px solid rgba(22,179,100,0.28); color: var(--green-bright); }
.tier-badge.tier-grove  { background: rgba(212,175,55,0.11); border: 1px solid rgba(212,175,55,0.28); color: var(--gold-bright); }
.tier-badge.tier-orchard {
  background: linear-gradient(135deg, rgba(212,175,55,0.18) 0%, rgba(232,199,102,0.12) 100%);
  border: 1px solid rgba(232,199,102,0.4);
  color: var(--gold-bright);
  box-shadow: 0 0 10px rgba(212,175,55,0.12);
}

.tier-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.tier-seed   .tier-dot { background: var(--text-secondary); }
.tier-sprout .tier-dot { background: var(--green-bright); box-shadow: 0 0 5px var(--green-glow); }
.tier-grove  .tier-dot { background: var(--gold); box-shadow: 0 0 5px var(--gold-glow); }
.tier-orchard .tier-dot { background: var(--gold-bright); box-shadow: 0 0 8px var(--gold-glow); }

.balance-next-tier {
  font-size: 11px;
  color: var(--hint);
  margin-top: 8px;
  position: relative;
}

/* ── Bottom tab bar ───────────────────────────────────── */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 300;
  max-width: 480px;
  margin: 0 auto;
  background: rgba(10,15,12,0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  padding: 8px 0 calc(8px + var(--safe-bottom));
  display: flex;
  align-items: center;
  justify-content: space-around;
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 6px 4px;
  color: var(--hint);
  min-height: 52px;
  min-width: 44px;
  transition: color 0.15s;
  position: relative;
  font-size: 22px;
  line-height: 1;
}

.tab-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1;
  font-family: -apple-system, "SF Pro Text", system-ui, sans-serif;
}

.tab-item.active { color: var(--green-bright); }

.tab-item.active::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 2px;
  background: var(--green-bright);
  border-radius: 0 0 2px 2px;
  box-shadow: 0 0 6px var(--green-glow);
}

.tab-item:active { opacity: 0.7; }

/* ── Action tiles (home grid) ─────────────────────────── */
.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 12px;
  margin-bottom: 10px;
}

.action-tile {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px 14px 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  box-shadow: var(--card-shadow-sm);
  transition: transform 0.12s var(--ease), box-shadow 0.12s;
  min-height: 100px;
  text-align: left;
  -webkit-user-select: none;
  user-select: none;
}

.action-tile:active {
  transform: scale(0.96);
  box-shadow: 0 1px 6px rgba(0,0,0,0.3);
}

.action-tile-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 20px;
  line-height: 1;
}

.tile-icon-green  { background: rgba(22,179,100,0.14); border: 1px solid rgba(22,179,100,0.24); }
.tile-icon-gold   { background: rgba(212,175,55,0.11); border: 1px solid rgba(212,175,55,0.24); }
.tile-icon-blue   { background: rgba(59,130,246,0.11); border: 1px solid rgba(59,130,246,0.22); }
.tile-icon-red    { background: rgba(194,59,59,0.11);  border: 1px solid rgba(194,59,59,0.22);  }
.tile-icon-purple { background: rgba(139,92,246,0.11); border: 1px solid rgba(139,92,246,0.22); }
.tile-icon-amber  { background: rgba(200,130,26,0.11); border: 1px solid rgba(200,130,26,0.22); }

.action-tile-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.action-tile-sub {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.35;
}

/* ── Onboarding card ──────────────────────────────────── */
.onboard-card {
  background: linear-gradient(145deg, rgba(22,179,100,0.09) 0%, rgba(22,179,100,0.03) 100%);
  border: 1px solid rgba(22,179,100,0.22);
  border-radius: var(--radius);
  padding: 28px 22px;
  margin: 14px 12px;
  text-align: center;
  box-shadow: 0 0 36px rgba(22,179,100,0.07);
}

.onboard-emoji { font-size: 52px; margin-bottom: 14px; line-height: 1; }

.onboard-card h2 {
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.onboard-card p {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.65;
}

.onboard-note {
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  text-align: left;
  line-height: 1.6;
}

/* ── Buttons ──────────────────────────────────────────── */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 15px 20px;
  background: linear-gradient(135deg, var(--green) 0%, var(--green-dim) 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  min-height: 52px;
  transition: opacity 0.15s, transform 0.1s var(--ease);
  -webkit-user-select: none;
  user-select: none;
  box-shadow: 0 4px 18px rgba(22,179,100,0.22), inset 0 1px 0 rgba(255,255,255,0.1);
  letter-spacing: 0.01em;
}
.btn-primary:active { transform: scale(0.98); opacity: 0.88; }
.btn-primary:disabled { opacity: 0.35; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 20px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  min-height: 44px;
  transition: background 0.15s, color 0.15s;
}
.btn-secondary:active { background: var(--bg-surface-2); color: var(--text); }

.btn-danger {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #C23B3B 0%, #9C2E2E 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  min-height: 46px;
  transition: opacity 0.15s, transform 0.1s;
  box-shadow: 0 4px 14px rgba(194,59,59,0.22);
  width: 100%;
}
.btn-danger:active { opacity: 0.85; transform: scale(0.98); }

.btn-refresh {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
  font-size: 16px;
  line-height: 1;
}
.btn-refresh:active { background: var(--bg-surface-2); color: var(--text); }

/* ── Inputs ───────────────────────────────────────────── */
.input-group { margin-bottom: 14px; }

.input-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 7px;
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.input-field {
  width: 100%;
  padding: 13px 14px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--text);
  outline: none;
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
  -webkit-appearance: none;
}
.input-field:focus {
  border-color: rgba(22,179,100,0.45);
  background: rgba(0,0,0,0.35);
  box-shadow: 0 0 0 3px rgba(22,179,100,0.09);
}
.input-field::placeholder { color: var(--hint); }

/* ── Scan input wrap ──────────────────────────────────── */
.scan-input-wrap { position: relative; }

.scan-clear-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-surface-2);
  border: none;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--hint);
  font-size: 13px;
}
.scan-clear-btn:active { color: var(--text); }

/* ── Quick chips / amount chips ──────────────────────── */
.chips-row {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.chip {
  background: rgba(0,0,0,0.22);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
  min-height: 36px;
  transition: all 0.12s var(--ease);
  -webkit-user-select: none;
  user-select: none;
  letter-spacing: 0.01em;
}
.chip.active {
  background: linear-gradient(135deg, var(--green) 0%, var(--green-dim) 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 8px rgba(22,179,100,0.22);
}
.chip:active { opacity: 0.8; }

/* ── Risk card ────────────────────────────────────────── */
.risk-card {
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 10px;
  border: 1px solid;
}

.risk-card.safe    { background: rgba(22,179,100,0.08);  border-color: rgba(22,179,100,0.26); color: #5EE8A4; }
.risk-card.caution { background: var(--caution-dim);      border-color: var(--caution-border);  color: #F5AC45; }
.risk-card.danger  { background: var(--danger-dim);       border-color: var(--danger-border);   color: #F08080; }
.risk-card.unknown { background: var(--bg-surface);       border-color: var(--border);          color: var(--text-secondary); }

.risk-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.risk-icon     { font-size: 28px; line-height: 1; flex-shrink: 0; }
.risk-title    { font-size: 16px; font-weight: 700; line-height: 1.2; }
.risk-subtitle { font-size: 12px; opacity: 0.75; margin-top: 2px; }

.risk-issues {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.risk-issue-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 12.5px;
  line-height: 1.45;
  opacity: 0.88;
}
.risk-issue-item::before { content: '•'; flex-shrink: 0; font-weight: 700; }

/* ── Cost breakdown card ──────────────────────────────── */
.cost-breakdown-card {
  background: rgba(0,0,0,0.2);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
}

.cost-breakdown-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.cost-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--separator);
  gap: 8px;
}
.cost-row:last-child { border-bottom: none; }

.cost-row-total {
  padding-top: 10px;
  border-top: 1px solid var(--border-strong);
  border-bottom: none;
}
.cost-row-receive { padding-top: 6px; }

.cost-label { font-size: 12.5px; color: var(--text-secondary); flex: 1; }
.cost-val {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.cost-val-highlight {
  font-size: 15px;
  font-weight: 700;
  color: var(--green-bright);
  font-variant-numeric: tabular-nums;
}

/* ── Quote preview loading ────────────────────────────── */
.quote-preview {
  background: rgba(0,0,0,0.18);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--border);
}
.quote-label { font-size: 13px; color: var(--text-secondary); }
.quote-value { font-size: 16px; font-weight: 700; color: var(--green-bright); }

/* ── Positions ────────────────────────────────────────── */
.position-item {
  display: flex;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--separator);
  gap: 12px;
}
.position-item:last-child { border-bottom: none; }

.position-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green-dim) 0%, var(--gold-dim) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.position-info { flex: 1; min-width: 0; }

.position-symbol {
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.position-amount {
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}

.position-sell-btn {
  background: linear-gradient(135deg, #C23B3B 0%, #9C2E2E 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-xs);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  min-height: 36px;
  flex-shrink: 0;
  transition: opacity 0.12s, transform 0.1s;
  box-shadow: 0 2px 8px rgba(194,59,59,0.22);
}
.position-sell-btn:active { opacity: 0.82; transform: scale(0.96); }

/* ── Modal (bottom sheet) ─────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-sheet {
  background: #111A13;
  border: 1px solid var(--border-strong);
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-width: 480px;
  padding: 20px 18px calc(28px + var(--safe-bottom));
  animation: slide-up 0.22s var(--ease) both;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.5);
}

@keyframes slide-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal-sheet::before {
  content: '';
  display: block;
  width: 36px;
  height: 4px;
  background: rgba(255,255,255,0.14);
  border-radius: 2px;
  margin: 0 auto 16px;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
  text-align: center;
  letter-spacing: -0.01em;
}

.modal-sub {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 18px;
}

/* ── Language picker sheet ────────────────────────────── */
.lang-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 58vh;
  overflow-y: auto;
}

.lang-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: none;
  border: 1px solid transparent;
  width: 100%;
  text-align: left;
  transition: background 0.12s;
  min-height: 50px;
  color: var(--text);
}
.lang-item:active { background: var(--bg-surface); }
.lang-item.selected {
  background: rgba(22,179,100,0.09);
  border-color: rgba(22,179,100,0.2);
}

.lang-flag { font-size: 22px; flex-shrink: 0; line-height: 1; }
.lang-name { font-size: 15px; font-weight: 500; flex: 1; color: var(--text); }
.lang-check { color: var(--green-bright); font-size: 16px; flex-shrink: 0; }

/* ── Skeleton shimmer ─────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position:  400px 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0.04) 25%,
    rgba(255,255,255,0.08) 50%,
    rgba(255,255,255,0.04) 75%
  );
  background-size: 800px 100%;
  animation: shimmer 1.6s infinite;
  border-radius: var(--radius-sm);
}
.sk-text { height: 13px; margin-bottom: 8px; border-radius: 6px; }
.sk-text.w70 { width: 70%; }
.sk-text.w45 { width: 45%; }
.sk-text.w30 { width: 30%; }
.sk-block { height: 90px; border-radius: var(--radius); }
.sk-block.tall { height: 148px; }

/* ── State cards (empty / error) ─────────────────────── */
.state-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 36px 20px;
  gap: 10px;
}
.state-icon  { font-size: 48px; line-height: 1; }
.state-title { font-size: 16px; font-weight: 600; color: var(--text); }
.state-msg   { font-size: 13.5px; color: var(--text-secondary); line-height: 1.55; }

/* ── Result screen ────────────────────────────────────── */
.result-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 52px 24px 28px;
  gap: 12px;
}
.result-icon  { font-size: 72px; line-height: 1; }
.result-title { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.result-sub   { font-size: 14px; color: var(--text-secondary); line-height: 1.6; }

.tx-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 10px 18px;
  font-size: 13px;
  color: var(--green-bright);
  font-weight: 500;
  margin-top: 4px;
  transition: background 0.15s;
}
.tx-link:active { background: var(--bg-surface-2); }

/* ── Section label ────────────────────────────────────── */
.section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--hint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 0 6px;
  margin-bottom: 2px;
}

/* ── Spinner ──────────────────────────────────────────── */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}
.spinner.dark {
  border-color: rgba(22,179,100,0.2);
  border-top-color: var(--green-bright);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: rgba(20,28,22,0.95);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  z-index: 999;
  opacity: 0;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
  pointer-events: none;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Security warning card (key reveal gate) ─────────── */
.security-warning-card {
  background: var(--danger-dim);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-sm);
  padding: 18px;
  color: #F08080;
  text-align: center;
}

.security-warning-list {
  list-style: none;
  margin: 0;
  padding: 0;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.security-warning-list li {
  font-size: 13px;
  line-height: 1.5;
  padding-left: 16px;
  position: relative;
}
.security-warning-list li::before {
  content: '•';
  position: absolute;
  left: 0;
  font-weight: 700;
}

/* ── Security tips list ──────────────────────────────── */
.security-tips-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.security-tips-list li {
  font-size: 13px;
  color: #F5AC45;
  line-height: 1.5;
  padding-left: 16px;
  position: relative;
}
.security-tips-list li::before {
  content: '•';
  position: absolute;
  left: 0;
  font-weight: 700;
}

/* ── Key reveal card ─────────────────────────────────── */
.key-reveal-card {
  background: var(--danger-dim);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.key-box {
  background: rgba(0,0,0,0.3);
  border-radius: var(--radius-xs);
  padding: 12px;
  margin-top: 8px;
  cursor: pointer;
  user-select: all;
  -webkit-user-select: all;
  min-height: 60px;
  display: flex;
  align-items: center;
  border: 1px dashed var(--danger-border);
  transition: background 0.12s;
}
.key-box:active { background: rgba(0,0,0,0.4); }

.key-warning-box {
  margin-top: 12px;
  background: rgba(0,0,0,0.25);
  border-radius: var(--radius-xs);
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.6;
  color: #F08080;
  text-align: center;
}

/* ── Fee row ──────────────────────────────────────────── */
.fee-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-top: 1px solid var(--separator);
}
.fee-label { font-size: 13px; color: var(--text-secondary); }
.fee-value  { font-size: 13px; font-weight: 600; }

/* ── Separator ────────────────────────────────────────── */
.sep { height: 1px; background: var(--separator); margin: 6px 0; }

/* ── Utils ────────────────────────────────────────────── */
.hidden     { display: none !important; }
.mt-sm      { margin-top: 8px; }
.mt-md      { margin-top: 14px; }
.mono       { font-family: "SF Mono", "Fira Code", ui-monospace, monospace; }
.truncate   { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.full-width { width: 100%; }

/* ── Home footer ──────────────────────────────────────── */
.home-footer {
  text-align: center;
  padding: 16px 16px 8px;
  font-size: 11px;
  color: var(--hint);
  line-height: 1.65;
}

/* ── RTL layout support ───────────────────────────────── */
[dir="rtl"] .balance-address-row { flex-direction: row-reverse; }
[dir="rtl"] .risk-header         { flex-direction: row-reverse; }
[dir="rtl"] .position-item       { flex-direction: row-reverse; }
[dir="rtl"] .cost-row            { flex-direction: row-reverse; }
[dir="rtl"] .chips-row           { flex-direction: row-reverse; }
[dir="rtl"] .action-tile         { align-items: flex-end; text-align: right; }
[dir="rtl"] .balance-address     { text-align: right; }
[dir="rtl"] .top-bar             { flex-direction: row-reverse; }
[dir="rtl"] .app-logo            { flex-direction: row-reverse; }
