/* Alxacard — minimal white theme with tasteful motion */
:root {
  --bg: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-600: #1d4ed8;
  --ring: rgba(37,99,235,0.25);
  --surface: #ffffff;
  --card: #f8fafc;
  --border: #e2e8f0;
  --shadow: 0 10px 30px rgba(2, 8, 23, 0.08);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Maintenance overlay */
.maintenance-overlay { position: fixed; inset: 0; background: #fff; display: grid; place-items: center; z-index: 1000; }
.maintenance-overlay .inner { text-align: center; padding: 20px; }
.maintenance-overlay h1 { margin: 0 0 8px; font-size: clamp(2rem, 3vw + 1rem, 3rem); }
.maintenance-overlay p { margin: 0; color: var(--muted); }
html.no-scroll, html.no-scroll body { overflow: hidden; }

#backdrop {
  position: fixed; inset: 0; pointer-events: none; opacity: 0; background: radial-gradient(1200px 600px at 70% -10%, rgba(37, 99, 235, 0.10), transparent 50%),
    radial-gradient(800px 400px at 0% 110%, rgba(16, 185, 129, 0.08), transparent 50%);
  transition: opacity .3s ease;
  z-index: 1;
}
#backdrop.active { opacity: 1; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; background: rgba(255,255,255,.85); backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand-mark { font-size: 1.25rem; }
.brand-name { letter-spacing: .3px; }

.header-actions { display: flex; align-items: center; gap: 10px; }
.auth-area { display: flex; align-items: center; gap: 10px; }
.auth-area #profileBtn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 10px; }
.auth-area #profileBtn .avatar { width: 22px; height: 22px; display: inline-grid; place-items: center; background: var(--card); border: 1px solid var(--border); border-radius: 999px; font-size: 12px; }

/* Buttons */
.btn { appearance: none; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 10px 14px; border-radius: 10px; cursor: pointer; transition: transform .03s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease; }
.btn:hover { border-color: #cbd5e1; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 8px 18px var(--ring); }
.btn.primary:hover { background: var(--primary-600); border-color: var(--primary-600); }
.btn.ghost { background: #fff; }
.btn.xs { padding: 6px 8px; font-size: .85rem; }
.btn.sm { padding: 8px 12px; font-size: .95rem; }

/* Alxa action buttons — iconified, color-coded with modern soft palette */
.alxa-action-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 8px;
  background: #fff; border: 1px solid #e2e8f0; color: #334155;
  font-size: 13px; font-weight: 500; line-height: 1.2;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.alxa-action-btn .icon { width: 16px; height: 16px; display: inline-grid; place-items: center; flex-shrink: 0; }
.alxa-action-btn .label { font-weight: 500; }
.alxa-action-btn:is(:hover,:focus-visible) { 
  border-color: #cbd5e1; 
  box-shadow: 0 4px 12px rgba(0,0,0,0.1); 
  transform: translateY(-1px);
}
.alxa-action-btn:active { transform: translateY(0px); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }

/* Deeper, more vibrant color variants */
.alxa-action-btn.is-deposit { 
  color: #14532d; 
  background: linear-gradient(135deg, #dcfce7, #bbf7d0); 
  border-color: #4ade80; 
}
.alxa-action-btn.is-deposit:is(:hover,:focus-visible) { 
  border-color: #22c55e; 
  box-shadow: 0 4px 16px rgba(20,83,45,0.2); 
}

.alxa-action-btn.is-create { 
  color: #1e3a8a; 
  background: linear-gradient(135deg, #dbeafe, #bfdbfe); 
  border-color: #3b82f6; 
}
.alxa-action-btn.is-create:is(:hover,:focus-visible) { 
  border-color: #2563eb; 
  box-shadow: 0 4px 16px rgba(30,58,138,0.2); 
}

.alxa-action-btn.is-replace { 
  color: #92400e; 
  background: linear-gradient(135deg, #fef3c7, #fde68a); 
  border-color: #f59e0b; 
}
.alxa-action-btn.is-replace:is(:hover,:focus-visible) { 
  border-color: #d97706; 
  box-shadow: 0 4px 16px rgba(146,64,14,0.2); 
}

.alxa-action-btn.is-send { 
  color: #581c87; 
  background: linear-gradient(135deg, #e9d5ff, #d8b4fe); 
  border-color: #8b5cf6; 
}
.alxa-action-btn.is-send:is(:hover,:focus-visible) { 
  border-color: #7c3aed; 
  box-shadow: 0 4px 16px rgba(88,28,135,0.2); 
}

.icon-btn { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid var(--border); background: #fff; cursor: pointer; }
.icon-btn:hover { border-color: #cbd5e1; }
.icon-btn.hidden { display: none !important; }

/* Hero */
.hero { min-height: calc(100dvh - 60px); display: grid; place-items: center; padding: 40px 16px; position: relative; z-index: 2; }
.hero-inner { text-align: center; max-width: 800px; }
.hero h1 { font-size: clamp(2rem, 2.5vw + 1rem, 3rem); margin: 0 0 10px; }
.hero p { margin: 0 0 20px; color: var(--muted); }
.hero-cta { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* Panels & Modals */
.panel, .modal {
  position: fixed; inset: auto 50% 50% auto; transform: translate(50%, 50%) scale(.98); opacity: 0; pointer-events: none;
  width: min(1200px, calc(100% - 40px)); max-height: min(90vh, 860px); overflow: visible !important;
  background: #fff; border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow);
  transition: opacity .2s ease, transform .2s ease;
  z-index: 20;
  font-size: 1.05rem;
}
.modal#profileModal { 
  width: min(720px, calc(100% - 32px)); 
  overflow: visible !important;
  max-height: none !important;
}
.panel#walletPanel { width: min(720px, calc(100% - 32px)); max-height: min(88vh, 660px); border-radius: 18px; }
.modal#authModal { width: min(540px, calc(100% - 32px)); max-height: min(88vh, 660px); border-radius: 18px; }
.panel[aria-hidden="false"], .modal[aria-hidden="false"] { opacity: 1; transform: translate(50%, 50%) scale(1); pointer-events: auto; }
.panel-header, .modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; border-bottom: 1px solid var(--border); }
.modal#profileModal .modal-header { justify-content: center; position: relative; }
.modal#profileModal .modal-header button { position: absolute; right: 12px; }
.panel#walletPanel .panel-header { justify-content: center; position: relative; }
.panel#walletPanel .panel-header [data-close-panel] { position: absolute; right: 12px; }
.panel-body { padding: 16px; }

/* Auth modal header centered with close button pinned */
#authModal .modal-header { position: relative; justify-content: center; padding: 16px 20px; }
#authModal .modal-header h2 { margin: 0; text-align: center; }
#authModal .modal-header [data-close-modal] { position: absolute; right: 12px; top: 10px; }

/* Tabs */
.tabs { display: flex; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab { appearance: none; border: 1px solid var(--border); background: var(--card); color: var(--text); padding: 8px 12px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.tab.active { background: var(--text); color: #fff; border-color: var(--text); }

/* Search */
.search { width: 360px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); outline: none; }
.search:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }

/* Cards grid */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; padding: 16px; overflow: auto; max-height: calc(min(90vh, 860px) - 170px); }
.card {
  display: grid; grid-template-rows: 140px auto; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: linear-gradient(180deg, #fff, #f8fafc);
  cursor: pointer; transition: transform .12s ease, box-shadow .2s ease, border-color .2s ease; position: relative; overflow: hidden;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #cbd5e1; }
.card .art { border-radius: 10px; display: grid; place-items: center; background: #f1f5f9; font-weight: 700; color: #0f172a; }
.card .meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.card .title { font-weight: 600; }
.card .tag { font-size: .75rem; color: var(--muted); }

/* Auth */
.label { display: block; font-size: .9rem; margin: 0 0 6px; text-align: center; }
.input { width: 100%; padding: 14px 14px; border-radius: 10px; border: 1px solid var(--border); outline: none; background-color: #fff; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
.input.otp { letter-spacing: .4em; text-align: center; font-size: 1.25rem; font-weight: 700; }
.helper { color: var(--muted); font-size: .9rem; }
.note { margin-top: 8px; font-size: .9rem; color: var(--muted); }
.auth-step { display: grid; gap: 12px; padding: 20px; }
.auth-step .btn { justify-self: center; min-width: 180px; }
.auth-step .btn.xs { justify-self: start; }
.auth-step .input#emailInput { padding-left: 42px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%2364748b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='M4 4h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z'/%3E%3Cpath d='m22 6-10 7L2 6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 12px center; background-size: 18px; }
.input.otp { font-variant-numeric: tabular-nums; }
/* Auth email step layout — vertical stack */
#authStepEmail { width: min(100%, 480px); margin: 0 auto; grid-template-columns: 1fr; align-items: stretch; row-gap: 12px; padding: 0; }
#authStepEmail .label { margin: 0 0 6px; text-align: left; font-weight: 600; }
#authStepEmail #emailInput { margin: 0; }
#authStepEmail #captchaRow { display: grid; grid-template-columns: 1fr; justify-items: center; align-items: center; gap: 6px; padding-top: 6px; }
#authStepEmail #sendCodeBtn { justify-self: stretch; }
#authStepEmail .helper, #authStepEmail #authNote { text-align: center; }
#recaptchaWidget { min-height: 78px; }
.hidden { display: none !important; }

/* 2FA flow UI polish - improved layout */
#sec2faFlow .flow-steps { list-style: none; padding-left: 0; margin: 0; }
#sec2faFlow .flow-body { display: grid; gap: 6px; }

/* Improved header layout */
.flow-header-improved {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}
.flow-header-improved .btn.xs {
  padding: 6px 12px;
  font-size: 13px;
}
.flow-header-improved h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
}

/* Improved step body with side-by-side layout */
.step-body-improved {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  align-items: start;
  padding: 16px;
  background: #fefefe;
  border-radius: 8px;
  border: 1px solid #f1f5f9;
}

.qr-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.qr-section img {
  width: 140px;
  height: 140px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
}
.qr-section .helper {
  text-align: center;
  font-size: 12px;
  color: #64748b;
  max-width: 150px;
  line-height: 1.3;
  margin: 0;
}

.input-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.input-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.input-label {
  font-size: 13px;
  font-weight: 500;
  color: #374151;
}
.input-section .input.otp {
  width: 180px;
  letter-spacing: .35em;
  font-size: 0.95rem;
  padding: 10px 12px;
}
.input-section .btn.primary {
  width: fit-content;
  padding: 10px 20px;
  font-size: 14px;
}
.secret-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}
.secret-row .input.compact {
  font-size: 12px;
  padding: 6px 8px;
}
.secret-row .btn.xs {
  padding: 6px 10px;
  font-size: 12px;
}

/* Responsive adjustments */
@media (max-width: 580px) {
  .step-body-improved {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .qr-section {
    justify-self: center;
  }
  .input-section .input.otp {
    width: 100%;
    max-width: 200px;
  }
}

/* 2FA email row: Send + Code side-by-side */
#sec2faFlow .sec2fa-email-row { display: grid; grid-auto-flow: column; align-items: center; justify-content: center; gap: 10px; }
#sec2faFlow .sec2fa-email-row .btn { width: auto; }
#sec2faFlow .sec2fa-email-row .input.otp { width: 200px; }
#sec2faFlow #sec2faEmailVerifyBtn { margin-top: 6px; }

/* PIN flow styling */
#pinFlow .flow-steps { list-style: none; padding-left: 0; margin: 0; }
#pinFlow .step-body { display: grid; gap: 8px; justify-items: center; padding: 8px 0; }
#pinFlow .input.otp { letter-spacing: .35em; font-size: 0.95rem; }
#pinFlow .btn.primary { font-size: 14px; }

@media (max-width: 480px) {
  #sec2faFlow .sec2fa-email-row { grid-auto-flow: row; }
  
  /* Responsive wallet action buttons */
  .alxa-action-btn { 
    padding: 6px 10px; 
    font-size: 12px; 
    gap: 5px; 
  }
  .alxa-action-btn .icon { 
    width: 14px; 
    height: 14px; 
  }
  .wallet-actions { 
    gap: 6px !important; 
  }
}

/* Profile */
.profile-body { 
  padding: 0 0 12px; 
  overflow: visible;
  height: auto;
  width: 100%;
}
.profile-body .tab-panels { 
  padding: 12px 16px; 
  overflow: visible;
  height: auto;
  min-height: 300px;
  width: 100%;
}
.profile-body .tab-panels .tab-panel { 
  display: block; 
  overflow: visible;
  width: 100%;
}
.security-split { display: grid; grid-template-columns: max-content 1fr; gap: 12px; align-items: start; }
.security-split .sec-nav { display: flex; flex-direction: column; gap: 6px; padding: 4px 8px 4px 0; border-right: 1px solid var(--border); }
.security-split .sec-tab {
  appearance: none; cursor: pointer; text-align: left;
  border: 1px solid var(--border); background: #fff; color: var(--text);
  padding: 6px 10px; border-radius: 8px; transition: background .2s ease, border-color .2s ease, box-shadow .2s ease, transform .03s ease;
  font-size: 14px; line-height: 1.3;
}
.security-split .sec-nav .sec-tab { width: max-content; align-self: flex-start; }
.security-split .sec-tab:hover { border-color: #cbd5e1; }
.security-split .sec-tab:active { transform: translateY(1px); }
.security-split .sec-tab:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring); }
.security-split .sec-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 8px 18px var(--ring); }
.security-split .sec-panels { padding: 0 0 0 4px; min-height: 240px; }
.profile-id-center { display: grid; justify-items: center; gap: 8px; margin: 8px 0 16px; }
.profile-id-center .id-label { color: var(--muted); font-size: .9rem; }
.profile-id-center .id-value {
  font-weight: 700; font-size: 1.05rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: .08em;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: inset 0 -1px 0 rgba(2,8,23,0.03);
}
.profile-id-center .id-value[data-empty="true"] { opacity: .6; }
.profile-id-center .btn.xs { border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; }
.profile-id-center .id-inline { display: inline-flex; align-items: center; gap: 8px; }

/* Enhanced Account tab layout */
.account-layout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 24px;
  margin-bottom: 20px;
}

/* Profile tab panels - ensure proper height and overflow */
.tab-panel {
  min-height: 300px;
  padding: 16px 0;
  /* Fix viewport positioning */
  position: relative !important;
  left: 0 !important;
  top: 0 !important;
  transform: none !important;
  margin: 0 !important;
}
.tab-panel[data-panel="alxa"] {
  min-height: 200px;
}
.tab-panel[data-panel="alxa"] #alxaWalletSlot {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Simple and clean tab visibility - ONLY target visible tabs */
#profileModal .tab-panel {
  display: none;
}

#profileModal .tab-panel.visible {
  display: block !important;
  padding: 16px;
  min-height: 200px;
}

#profileModal .tab-panel.hidden {
  display: none !important;
}

/* Make sure content in visible tabs is actually visible */
#profileModal .tab-panel.visible .payments-content,
#profileModal .tab-panel.visible .payments-header,
#profileModal .tab-panel.visible .payments-placeholder,
#profileModal .tab-panel.visible .security-split,
#profileModal .tab-panel.visible .sec-nav,
#profileModal .tab-panel.visible .sec-panels,
#profileModal .tab-panel.visible .wallet-content,
#profileModal .tab-panel.visible .account-layout {
  display: block;
  visibility: visible;
  opacity: 1;
}

/* Wallet */
.wallet-content { display: block; }
.wallet-balance { display: block; margin: 10px 0 20px; }
#profileModal .profile-body .tab-panels .tab-panel[data-panel="alxa"]:not(.hidden) .wallet-content {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  height: auto !important;
  min-height: 150px !important;
}

#profileModal .profile-body .tab-panels .tab-panel[data-panel="alxa"]:not(.hidden) .wallet-balance {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  margin: 10px 0 20px !important;
}

#profileModal .profile-body .tab-panels .tab-panel[data-panel="alxa"]:not(.hidden) .wallet-balance .amount-row {
  display: inline-flex !important;
  align-items: baseline !important;
  gap: 10px !important;
}

#profileModal .profile-body .tab-panels .tab-panel[data-panel="alxa"]:not(.hidden) .wallet-balance .amount {
  font-size: 2rem !important;
  font-weight: 800 !important;
  color: var(--text) !important;
}

#profileModal .profile-body .tab-panels .tab-panel[data-panel="alxa"]:not(.hidden) .wallet-balance .label {
  color: var(--muted) !important;
  font-weight: 600 !important;
}

#profileModal .profile-body .tab-panels .tab-panel[data-panel="alxa"]:not(.hidden) .wallet-actions {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  gap: 8px !important;
  flex-wrap: wrap !important;
  margin-top: 10px !important;
  align-items: center !important;
}

#profileModal .profile-body .tab-panels .tab-panel[data-panel="alxa"]:not(.hidden) #alxaWalletSlot * {
  visibility: visible !important;
  opacity: 1 !important;
  color: var(--text) !important;
}

#profileModal .profile-body .tab-panels .tab-panel[data-panel="alxa"]:not(.hidden) .alxa-action-btn {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 8px 12px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  line-height: 1.2 !important;
  border-radius: 8px !important;
}

#profileModal .profile-body .tab-panels .tab-panel[data-panel="alxa"]:not(.hidden) #alxaWalletSlot {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  height: auto !important;
  width: 100% !important;
}

/* Force payments content */
#profileModal .profile-body .tab-panels .tab-panel[data-panel="payments"]:not(.hidden) .payments-content {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  height: auto !important;
  min-height: 100px !important;
  width: 100% !important;
}

#profileModal .profile-body .tab-panels .tab-panel[data-panel="payments"]:not(.hidden) .payments-header h3 {
  margin: 0 0 12px 0 !important;
  font-size: 16px !important;
  color: var(--text) !important;
}

#profileModal .profile-body .tab-panels .tab-panel[data-panel="payments"]:not(.hidden) .payments-header p {
  color: var(--muted) !important;
  margin-bottom: 16px !important;
}

#profileModal .profile-body .tab-panels .tab-panel[data-panel="payments"]:not(.hidden) .payments-placeholder {
  text-align: center !important;
  padding: 40px 20px !important;
}

#profileModal .profile-body .tab-panels .tab-panel[data-panel="payments"]:not(.hidden) .placeholder-icon {
  font-size: 48px !important;
  opacity: 0.3 !important;
  margin-bottom: 12px !important;
}

#profileModal .profile-body .tab-panels .tab-panel[data-panel="payments"]:not(.hidden) .payments-placeholder p {
  color: #64748b !important;
  margin: 0 !important;
}

/* Force security content */
#profileModal .profile-body .tab-panels .tab-panel[data-panel="security"]:not(.hidden) .security-split {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  height: auto !important;
  min-height: 100px !important;
  width: 100% !important;
}

#profileModal .profile-body .tab-panels .tab-panel[data-panel="security"]:not(.hidden) .sec-nav {
  display: flex !important;
  gap: 8px !important;
  padding: 0 0 16px 0 !important;
  border-bottom: 1px solid var(--border) !important;
}

#profileModal .profile-body .tab-panels .tab-panel[data-panel="security"]:not(.hidden) .sec-tab {
  padding: 8px 16px !important;
  border: 1px solid var(--border) !important;
  background: var(--card) !important;
  color: var(--text) !important;
  border-radius: 6px !important;
  cursor: pointer !important;
}

#profileModal .profile-body .tab-panels .tab-panel[data-panel="security"]:not(.hidden) .sec-panels {
  padding: 16px 0 !important;
}

#profileModal .profile-body .tab-panels .tab-panel[data-panel="security"]:not(.hidden) .sec-panel h3 {
  margin: 0 0 8px 0 !important;
  font-size: 16px !important;
  color: var(--text) !important;
}

/* Public ID section with QR */
.public-id-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 140px;
}
.id-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.id-label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin: 0;
}
.id-display {
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  text-align: center;
}
.id-value {
  font-family: 'Courier New', monospace;
  font-size: 11px;
  font-weight: 600;
  color: #1e293b;
  letter-spacing: 0.5px;
  line-height: 1.2;
  word-break: break-all;
}
.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.public-id-qr {
  width: 100px;
  height: 100px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
}
.qr-label {
  font-size: 11px;
  color: #64748b;
  text-align: center;
  line-height: 1.2;
}

/* Account details section */
.account-details {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.detail-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.detail-item {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 12px 16px;
  background: #fefefe;
  border: 1px solid #f1f5f9;
  border-radius: 8px;
}
.detail-label {
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  padding-top: 2px;
}
.detail-value {
  min-height: 20px;
  display: flex;
  align-items: center;
  font-size: 14px;
  color: #1e293b;
}
.detail-item .btn.xs {
  justify-self: end;
  align-self: start;
}

/* Account footer */
.account-footer {
  border-top: 1px solid #f1f5f9;
  padding-top: 16px;
  margin-top: 4px;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .account-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .public-id-section {
    min-width: auto;
  }
  .id-header {
    justify-content: center;
  }
  .detail-item {
    grid-template-columns: 1fr;
    gap: 8px;
    text-align: left;
  }
  .detail-item .btn.xs {
    justify-self: start;
    margin-top: 4px;
  }
}

/* Payments tab content */
.payments-content {
  padding: 16px 0;
}
.payments-header h3 {
  color: #1e293b;
  font-weight: 600;
}
.payments-placeholder {
  text-align: center;
  padding: 40px 20px;
  border: 1px dashed #e2e8f0;
  border-radius: 8px;
  background: #fafbfc;
}
.username { color: var(--muted); font-size: .95rem; }
.username-wrap { display: grid; grid-template-columns: auto 1fr; align-items: center; }
.username-wrap .prefix { padding: 0 10px; border: 1px solid var(--border); border-right: none; border-radius: 10px 0 0 10px; background: var(--card); height: 44px; display: grid; place-items: center; color: var(--muted); }
.username-wrap .input { border-radius: 0 10px 10px 0; }
.id-row { display: none; }
/* Profile display/edit rows */
.display-row { padding: 8px 0; color: var(--muted); }
.edit-group { margin-top: 4px; }
.profile-actions .btn.hidden { display: none !important; }
/* Profile: field errors and statuses */
.field-error { color: #b91c1c; font-size: .85rem; min-height: 1em; }
.status-box { margin-top: 6px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); background: #f8fafc; color: var(--muted); font-size: .9rem; }
.status-box.ok { border-color: #22c55e; background: #f0fdf4; color: #166534; }
.status-box.warn { border-color: #f59e0b; background: #fffbeb; color: #92400e; }
.status-box.err { border-color: #ef4444; background: #fef2f2; color: #991b1b; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 999px; font-size: .8rem; border: 1px solid var(--border); background: #f8fafc; color: var(--muted); }
.badge.ok { border-color: #22c55e; background: #f0fdf4; color: #166534; }
.badge.warn { border-color: #f59e0b; background: #fffbeb; color: #92400e; }
.badge.err { border-color: #ef4444; background: #fef2f2; color: #991b1b; }
.kv-row.with-action { /* keep grid layout from .kv-row; just ensure alignment */ align-items: center; }
.kv-value .inline-edit { margin-top: 0; }
.section-label { font-weight: 600; color: var(--text); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,1,1); white-space: nowrap; border: 0; }
/* Key-Value rows (lightweight) */
.kv-row { display: grid; grid-template-columns: 160px 1fr auto; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.kv-row:first-of-type { border-top: none; }
.kv-row.plain { border: none; padding: 2px 0; }
.kv-row.compact { padding: 4px 0; gap: 8px; grid-template-columns: 140px 1fr auto; }
.inline-edit { margin-top: 6px; }
.inline-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.input.compact { padding: 10px 12px; }
.kv-row.compact .kv-label { font-size: 14px; }
.kv-row.compact .kv-value { font-size: 14px; line-height: 1.3; }
.username-wrap.compact .prefix { height: 38px; }
.username-wrap.compact .input { height: 38px; }
.kv-value .hint-yellow { background: #fffbeb; color: #92400e; padding: 2px 6px; border-radius: 6px; font-weight: 600; }
.kv-label { color: var(--muted); font-size: .95rem; }
.kv-value { font-weight: 600; }
.btn[aria-disabled="true"] { opacity: .5; pointer-events: auto; cursor: not-allowed; }

/* Avatar modal */
.modal#avatarModal { width: min(520px, calc(100% - 32px)); }
.avatar-body { padding: 16px; display: grid; gap: 12px; }
.avatar-preview { display: grid; place-items: center; border: 1px solid var(--border); border-radius: 12px; background: var(--card); padding: 10px; }
.avatar-controls { display: flex; gap: 10px; justify-content: space-between; align-items: center; }
.profile-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 8px; }

/* Wallet */
.wallet-content { display: block; }
.wallet-balance { display: block; margin: 10px 0 20px; }
.wallet-balance .amount-row { display: inline-flex; align-items: baseline; gap: 10px; }
.wallet-balance .amount { font-size: 2rem; font-weight: 800; }
.wallet-balance .label { color: var(--muted); font-weight: 600; }

/* Wallet content in profile context */
#profileModal .wallet-content {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  min-height: 150px !important;
}

#profileModal .wallet-balance {
  display: block !important;
  margin: 10px 0 20px !important;
}

#profileModal .wallet-actions {
  display: flex !important;
  gap: 8px !important;
  flex-wrap: wrap !important;
  margin-top: 10px !important;
  align-items: center !important;
}

.empty-state { border: 1px dashed var(--border); border-radius: 12px; padding: 14px; display: grid; gap: 8px; }
.flex-spacer { flex: 1 1 auto; }

/* Wallet in-tab flow */
.wallet-flow { border: 1px solid var(--border); border-radius: 12px; background: var(--card); box-shadow: inset 0 -1px 0 rgba(2,8,23,0.03); margin-top: 12px; }
.wallet-flow .flow-header { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.wallet-flow .flow-header h3 { margin: 0; font-size: 1rem; }
.wallet-flow .flow-body { max-height: 380px; overflow: auto; padding: 12px; }

/* Make deposit view content itself scrollable when inside flow */
.wallet-flow .wallet-view { padding: 0; }

/* Toast */
.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%) translateY(20px); opacity: 0; background: #0f172a; color: #fff; padding: 10px 14px; border-radius: 999px; box-shadow: var(--shadow); transition: opacity .2s ease, transform .2s ease; z-index: 50; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Checkout */
.checkout-body { display: grid; gap: 14px; padding: 16px; }
.product-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; }
.product-row .label { color: var(--muted); }
.product-row .value { font-weight: 700; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.field { display: grid; gap: 6px; }
.field-label { font-size: .9rem; color: var(--muted); }
.checkout-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 4px; }

@media (max-width: 640px) {
  .grid { grid-template-columns: 1fr; }
  .security-split { grid-template-columns: 1fr; }
  .security-split .sec-nav { border-right: none; border-bottom: 1px solid var(--border); padding: 0 0 8px 0; }
}

/* Responsive */
@media (max-width: 520px) {
  .search { width: 100%; }
  .cards-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  #authStepEmail { grid-template-columns: 1fr; }
  #authStepEmail .label { text-align: left; margin: 0 0 6px; }
  #authStepEmail #captchaRow { justify-content: flex-start; }
}
