/* ── BGT WALLET PWA — Design System ──────────────────────── */
:root {
  --bg:        #0B0E11;
  --bg2:       #1E2026;
  --bg3:       #2B2F36;
  --gold:      #F0B90B;
  --gold-dim:  rgba(240,185,11,0.15);
  --white:     #EAECEF;
  --white2:    #848E9C;
  --white3:    #474D57;
  --green:     #0ECB81;
  --red:       #F6465D;
  --border:    #2B2F36;
  --usdt:      #26A17B;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

[data-theme="light"] {
  --bg:        #FAFAFA;
  --bg2:       #FFFFFF;
  --bg3:       #F0F0F0;
  --gold-dim:  rgba(240,185,11,0.12);
  --white:     #1E2026;
  --white2:    #5E6673;
  --white3:    #9CA3AF;
  --border:    #E5E7EB;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--white);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  height: 100%;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}

#app {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

.hidden { display: none !important; }

/* ── Header ─────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.header-title {
  font-size: 16px; font-weight: 700;
  letter-spacing: 0.3px;
}
.header-icons { display: flex; gap: 20px; align-items: center; }
.icon-btn {
  background: none; border: none; padding: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--white2);
  cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; }

/* ── Buttons ────────────────────────────────────────── */
.btn-primary {
  background: var(--gold);
  color: var(--bg);
  border: none;
  border-radius: 12px;
  padding: 16px;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  width: 100%;
}
.btn-primary:disabled { opacity: 0.5; }
.btn-secondary {
  background: var(--bg3);
  color: var(--white);
  border: 1.5px solid var(--white3);
  border-radius: 12px;
  padding: 16px;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  width: 100%;
}
.btn-danger {
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 16px;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  width: 100%;
}

/* ── Inputs ─────────────────────────────────────────── */
.input-label {
  font-size: 12px;
  color: var(--white2);
  font-weight: 600;
  margin-bottom: 8px;
  display: block;
}
.input {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 15px;
  color: var(--white);
  font-size: 14px;
  width: 100%;
  font-family: inherit;
}
.input::placeholder { color: var(--white3); }
.input:focus { outline: none; border-color: var(--gold); }

/* ── PIN ────────────────────────────────────────────── */
.pin-title { font-size: 18px; font-weight: 700; margin-top: 8px; }
.pin-sub { font-size: 13px; color: var(--white2); margin-top: 6px; text-align: center; padding: 0 24px; }
.pin-dots { display: flex; gap: 14px; margin: 28px 0; }
.pin-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--white3);
  background: transparent;
  transition: background 0.15s, border-color 0.15s;
}
.pin-dot.filled { background: var(--gold); border-color: var(--gold); }
.pin-dot.shake { animation: shake 0.4s; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}
.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  width: 100%;
  max-width: 280px;
  padding: 0 24px;
}
.pin-key {
  background: var(--bg2);
  border: none;
  border-radius: 50%;
  width: 68px; height: 68px;
  font-size: 24px;
  font-weight: 600;
  color: var(--white);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto;
  cursor: pointer;
}
.pin-key:active { background: var(--bg3); }
.pin-key.empty { background: transparent; cursor: default; }

/* ── Cards / Lists ──────────────────────────────────── */
.card {
  background: var(--bg2);
  border-radius: 14px;
  padding: 16px;
  border: 1px solid var(--border);
}
.row {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.row:last-child { border-bottom: none; }

/* ── Toast ──────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(24px + var(--safe-bottom));
  left: 20px; right: 20px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  z-index: 1000;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}
.toast-bar {
  height: 3px;
  background: var(--gold);
  border-radius: 2px;
  margin-top: 10px;
  transition: width 0.1s linear;
}

/* ── Modal ──────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 24px;
}
.modal-box {
  background: var(--bg2);
  border-radius: 20px;
  padding: 24px;
  width: 100%;
  max-width: 340px;
  border: 1px solid var(--border);
}
.modal-icon { font-size: 40px; text-align: center; margin-bottom: 16px; }
.modal-title { font-size: 18px; font-weight: 700; text-align: center; margin-bottom: 10px; }
.modal-msg { font-size: 14px; color: var(--white2); text-align: center; line-height: 1.5; margin-bottom: 24px; white-space: pre-line; }
.modal-buttons { display: flex; flex-direction: column; gap: 10px; }

/* ── Loading ────────────────────────────────────────── */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--bg3);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay {
  position: absolute; top:0; left:0; right:0; bottom:0;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 500;
}

/* ── Splash ─────────────────────────────────────────── */
.splash {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.splash-logo {
  width: 88px; height: 88px;
  border-radius: 22px;
  background: var(--gold-dim);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 800; color: var(--gold);
  letter-spacing: 1px;
}

/* ── Home action buttons ────────────────────────────── */
.action-btn {
  flex: 1;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--white);
  font-size: 12px;
  font-weight: 500;
}
.action-icon {
  width: 38px; height: 38px;
  border-radius: 19px;
  background: var(--gold-dim);
  color: var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
}
.coin-row {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.coin-icon {
  width: 38px; height: 38px;
  border-radius: 19px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
  margin-right: 12px;
  flex-shrink: 0;
}
.tx-row {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.tx-icon {
  width: 36px; height: 36px;
  border-radius: 18px;
  background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  margin-right: 12px;
  flex-shrink: 0;
  font-size: 14px;
}

/* ── utility ────────────────────────────────────────── */
.setting-row {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  background: none;
  border-left: none; border-right: none; border-top: none;
  width: 100%;
  text-align: left;
  color: var(--white);
  font-family: inherit;
}
.setting-icon {
  width: 36px; height: 36px;
  border-radius: 18px;
  background: var(--gold-dim);
  display: flex; align-items: center; justify-content: center;
  margin-right: 12px;
  flex-shrink: 0;
  font-size: 15px;
}
.setting-label { font-size: 14px; font-weight: 600; }
.setting-sub { font-size: 12px; color: var(--white2); margin-top: 2px; }
.section-label {
  font-size: 11px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: var(--white2);
  padding: 18px 16px 8px;
}
.switch {
  width: 46px; height: 26px;
  border-radius: 13px;
  background: var(--bg3);
  padding: 2px;
  cursor: pointer;
  border: none;
  flex-shrink: 0;
  display: flex;
}
.switch.on { background: var(--gold); justify-content: flex-end; }
.switch-knob { width: 22px; height: 22px; border-radius: 11px; background: #fff; }

/* utility */
.flex-row { display: flex; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.flex-1 { flex: 1; }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }