@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root{
  --bg:            #FFFFFF;
  --bg-soft:       #F2F3F5;
  --bg-elevated:   #FFFFFF;
  --card:          #FFFFFF;
  --card-soft:     #F2F3F5;
  --border:        rgba(0,0,0,0.06);
  --border-strong: rgba(0,0,0,0.12);

  --text:          #0A0A0A;
  --text-2:        #6B6B70;
  --text-3:        #A0A0A8;

  --accent:        #21A038;
  --accent-press:  #18862D;
  --accent-soft:   rgba(33,160,56,0.10);
  --accent-text:   #FFFFFF;

  --red:           #E53935;
  --red-soft:      rgba(229,57,53,0.10);

  --shadow-sm:     0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:     0 2px 12px rgba(0,0,0,0.06);
  --shadow-lg:     0 8px 32px rgba(0,0,0,0.10);

  --radius-xl:     20px;
  --radius-lg:     16px;
  --radius-md:     12px;
  --radius-sm:     10px;
  --radius-pill:   999px;

  --safe-top:      env(safe-area-inset-top);
  --safe-bottom:   env(safe-area-inset-bottom);

  color-scheme: light;
}

[data-theme="dark"]{
  --bg:            #0B0B0E;
  --bg-soft:       #15161A;
  --bg-elevated:   #1A1B20;
  --card:          #1A1B20;
  --card-soft:     #232428;
  --border:        rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.14);

  --text:          #F5F5F7;
  --text-2:        #9A9AA2;
  --text-3:        #6B6B72;

  --accent:        #2ECC5E;
  --accent-press:  #26A84C;
  --accent-soft:   rgba(46,204,94,0.14);
  --accent-text:   #06210E;

  --red:           #FF5C6C;
  --red-soft:      rgba(255,92,108,0.14);

  --shadow-sm:     0 1px 2px rgba(0,0,0,0.4);
  --shadow-md:     0 2px 12px rgba(0,0,0,0.5);
  --shadow-lg:     0 8px 32px rgba(0,0,0,0.6);

  color-scheme: dark;
}

*{ box-sizing:border-box; margin:0; padding:0; -webkit-tap-highlight-color:transparent; }

html, body{ height:100%; overscroll-behavior:none; }

body{
  background:var(--bg);
  color:var(--text);
  font-family:'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size:15px;
  line-height:1.45;
  overflow:hidden;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  transition:background-color .2s ease, color .2s ease;
}

button, input, textarea{ font-family:inherit; color:inherit; font-size:inherit; }
input, textarea{ background:transparent; border:none; outline:none; }
button{ border:none; background:none; cursor:pointer; }
a{ color:inherit; text-decoration:none; }

.screen{
  position:fixed; inset:0;
  display:none;
  flex-direction:column;
  background:var(--bg);
}
.screen.active{ display:flex; }

.view{
  position:absolute; inset:0;
  display:none;
  flex-direction:column;
  background:var(--bg);
}
.view.active{ display:flex; }

#screen-splash{ align-items:center; justify-content:center; }
.splash-wrap{ display:flex; flex-direction:column; align-items:center; gap:16px; }
.splash-logo{
  width:76px; height:76px; border-radius:22px;
  background:var(--accent);
  display:flex; align-items:center; justify-content:center;
  font-weight:800; font-size:34px; color:var(--accent-text);
  box-shadow:0 8px 28px var(--accent-soft);
  animation:pulse 1.8s ease-in-out infinite;
}
.splash-name{ font-weight:700; font-size:18px; color:var(--text-2); letter-spacing:.02em; }
@keyframes pulse{
  0%,100%{ transform:scale(1); }
  50%{ transform:scale(1.06); }
}

#screen-login, #screen-register{ overflow-y:auto; }

.auth-wrap{
  max-width:420px; margin:0 auto; width:100%;
  padding:calc(32px + var(--safe-top)) 24px calc(32px + var(--safe-bottom));
}

.auth-brand{
  display:flex; flex-direction:column; align-items:center;
  gap:12px; margin-bottom:36px;
}
.auth-logo{
  width:64px; height:64px; border-radius:20px;
  background:var(--accent);
  display:flex; align-items:center; justify-content:center;
  font-size:32px; font-weight:800; color:var(--accent-text);
  box-shadow:0 8px 24px var(--accent-soft);
}
.auth-brand-name{
  font-size:16px; font-weight:800; letter-spacing:.14em;
  color:var(--accent);
}

.auth-title{
  font-weight:800;
  font-size:24px;
  margin-bottom:26px;
  letter-spacing:-0.02em;
}

.auth-subtitle{ color:var(--text-2); font-size:14.5px; margin-bottom:26px; }

.back-btn{
  width:40px; height:40px;
  border-radius:12px;
  background:var(--bg-soft);
  display:flex; align-items:center; justify-content:center;
  margin-bottom:20px;
  color:var(--text);
}
.back-btn svg{ width:20px; height:20px; }

.auth-form{ display:flex; flex-direction:column; gap:12px; }

.field{ display:flex; }
.field input{
  width:100%;
  background:var(--bg-soft);
  border-radius:var(--radius-md);
  padding:18px 16px;
  font-size:16px;
  font-weight:500;
  color:var(--text);
  transition:background-color .15s ease;
  border:1.5px solid transparent;
}
.field input:focus{ background:var(--bg); border-color:var(--accent); }
.field input::placeholder{ color:var(--text-3); font-weight:400; }

.pw-wrap{ position:relative; display:flex; width:100%; }
.pw-wrap input{ padding-right:52px; }
.pw-toggle{
  position:absolute; right:8px; top:50%; transform:translateY(-50%);
  width:40px; height:40px; border-radius:10px;
  display:flex; align-items:center; justify-content:center;
  color:var(--text-3);
}
.pw-toggle svg{ width:20px; height:20px; }

.input-status-wrap{ position:relative; display:flex; width:100%; }
.input-status-wrap input{ padding-right:52px; }
.input-status{
  position:absolute; right:18px; top:50%; transform:translateY(-50%);
  font-size:18px; font-weight:700; width:20px; text-align:center;
}
.input-status.ok::after{ content:'✓'; color:var(--accent); }
.input-status.taken::after{ content:'✕'; color:var(--red); }
.input-status.checking::after{ content:'…'; color:var(--text-3); }

.form-error{
  color:var(--red); font-size:14px; min-height:1px;
  padding:0 4px; font-weight:500;
}
.form-error:empty{ display:none; }

.auth-links{
  display:flex; justify-content:space-between; align-items:center;
  margin-top:24px; padding:0 4px;
}
.auth-link-strong{ color:var(--accent); font-weight:700; font-size:15px; }
.auth-link-muted{ color:var(--text-2); font-size:14px; font-weight:500; }

.auth-switch{
  margin-top:22px; text-align:center; font-size:14.5px; color:var(--text-2);
}
.auth-switch a{ color:var(--accent); font-weight:700; }

.btn{
  border-radius:var(--radius-md);
  font-weight:700; font-size:16px;
  padding:17px 22px;
  display:flex; align-items:center; justify-content:center; gap:8px;
  transition:transform .12s ease, opacity .12s ease, background-color .15s ease;
  min-height:56px;
}
.btn:active{ transform:scale(0.98); }
.btn:disabled{ opacity:.45; pointer-events:none; }
.btn-block{ width:100%; }

.btn-primary{ background:var(--accent); color:var(--accent-text); }
.btn-primary:active{ background:var(--accent-press); }
.btn-ghost{ background:var(--bg-soft); color:var(--text); }
.btn-danger{ background:var(--red); color:#fff; }
.btn-danger-ghost{ background:var(--red-soft); color:var(--red); }

.btn-spinner{
  width:18px; height:18px; border-radius:50%;
  border:2px solid rgba(255,255,255,0.35); border-top-color:#fff;
  animation:spin .7s linear infinite;
}
.btn-ghost .btn-spinner{ border-color:rgba(0,0,0,0.2); border-top-color:var(--text); }
@keyframes spin{ to{ transform:rotate(360deg); } }
#screen-app{ position:fixed; inset:0; }

.app-topbar{
  display:flex; align-items:center; justify-content:space-between;
  padding:calc(14px + var(--safe-top)) 20px 12px;
  flex-shrink:0;
  gap:12px;
}

.topbar-title{
  font-weight:700; font-size:17px;
  flex:1; text-align:center;
  letter-spacing:-0.01em;
}

.topbar-user{ display:flex; align-items:center; gap:10px; flex:1; min-width:0; }
.topbar-avatar{
  width:40px; height:40px; border-radius:14px;
  background:var(--accent);
  color:var(--accent-text);
  display:flex; align-items:center; justify-content:center;
  font-size:18px; font-weight:800;
  flex-shrink:0;
}
.topbar-name{
  font-weight:700; font-size:16px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}

.icon-btn{
  width:42px; height:42px; border-radius:14px;
  background:var(--bg-soft);
  display:flex; align-items:center; justify-content:center;
  color:var(--text);
  flex-shrink:0;
}
.icon-btn svg{ width:20px; height:20px; }
.icon-btn-spacer{ width:42px; }

.scroll-area{
  flex:1; overflow-y:auto; -webkit-overflow-scrolling:touch;
  padding:0 20px calc(120px + var(--safe-bottom));
  overscroll-behavior:contain;
}

.wallet-scroller{
  display:flex; gap:12px;
  overflow-x:auto; -webkit-overflow-scrolling:touch;
  margin:8px -20px 22px;
  padding:0 20px 4px;
  scroll-snap-type:x mandatory;
}
.wallet-scroller::-webkit-scrollbar{ display:none; }

.wallet-card{
  flex-shrink:0;
  width:270px;
  min-height:150px;
  border-radius:var(--radius-xl);
  padding:20px;
  display:flex; flex-direction:column; justify-content:space-between;
  scroll-snap-align:start;
  background:var(--bg-soft);
  color:var(--text);
  position:relative; overflow:hidden;
}

.wallet-card-account{
  background:linear-gradient(135deg, var(--accent) 0%, var(--accent-press) 100%);
  color:#fff;
}

.wallet-card-label{
  font-size:13px; font-weight:600;
  opacity:.85;
}
.wallet-card-account .wallet-card-label{ color:rgba(255,255,255,0.85); }

.wallet-card-amount{
  font-size:30px; font-weight:800;
  letter-spacing:-0.03em;
  font-variant-numeric:tabular-nums;
}

.wallet-card-bottom{
  font-size:13px; font-weight:500;
  opacity:.85;
  letter-spacing:.02em;
}
.wallet-card-account .wallet-card-bottom{ color:rgba(255,255,255,0.85); }

.quick-actions{
  display:grid; grid-template-columns:repeat(4,1fr);
  gap:10px; margin-bottom:28px;
}
.quick-action{
  display:flex; flex-direction:column; align-items:center; gap:8px;
  background:var(--bg-soft);
  border-radius:var(--radius-lg);
  padding:14px 6px;
  font-size:12px; font-weight:600; color:var(--text);
  transition:transform .12s ease;
}
.quick-action:active{ transform:scale(0.96); }
.quick-action-ic{
  width:40px; height:40px; border-radius:14px;
  background:var(--bg);
  display:flex; align-items:center; justify-content:center;
  color:var(--accent);
  box-shadow:var(--shadow-sm);
}
.quick-action-ic svg{ width:22px; height:22px; }

.section-title-row{
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom:12px;
}
.section-title{ font-weight:800; font-size:18px; letter-spacing:-0.01em; }
.section-link{ font-size:14px; color:var(--accent); font-weight:600; }

.tx-list{ display:flex; flex-direction:column; }
.tx-item{
  display:flex; align-items:center; gap:14px;
  padding:14px 0;
  border-bottom:1px solid var(--border);
  transition:opacity .12s ease;
}
.tx-item:active{ opacity:.6; }
.tx-item:last-child{ border-bottom:none; }

.tx-ic{
  width:44px; height:44px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  flex-shrink:0;
}
.tx-ic svg{ width:20px; height:20px; }
.tx-ic.in{ background:var(--accent-soft); color:var(--accent); }
.tx-ic.out{ background:var(--red-soft); color:var(--red); }

.tx-body{ flex:1; min-width:0; }
.tx-title{
  font-size:15.5px; font-weight:600;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  letter-spacing:-0.01em;
}
.tx-sub{ font-size:13px; color:var(--text-2); margin-top:3px; }

.tx-amount{
  font-weight:700; font-size:15.5px; white-space:nowrap;
  font-variant-numeric:tabular-nums;
}
.tx-amount.in{ color:var(--accent); }
.tx-amount.out{ color:var(--text); }

.empty-hint{
  color:var(--text-3); font-size:14.5px;
  text-align:center; padding:48px 0;
  font-weight:500;
}

.segmented{
  display:flex;
  background:var(--bg-soft);
  border-radius:var(--radius-md);
  padding:4px;
  margin-bottom:22px;
  gap:4px;
}
.segmented-btn{
  flex:1; padding:12px;
  border-radius:9px;
  font-size:14px; font-weight:700;
  color:var(--text-2);
  transition:background-color .15s ease, color .15s ease;
}
.segmented-btn.active{
  background:var(--bg);
  color:var(--text);
  box-shadow:var(--shadow-sm);
}

.pane-form{ display:flex; flex-direction:column; gap:14px; }

.recipient-preview{
  display:flex; align-items:center; gap:12px;
  background:var(--accent-soft);
  border-radius:var(--radius-md);
  padding:14px 16px;
  font-size:15px; font-weight:600;
  margin-top:-4px;
}
.recipient-preview[hidden]{ display:none; }
.recipient-preview.error{
  background:var(--red-soft);
  color:var(--red);
  font-weight:600;
}
.recipient-avatar{
  width:34px; height:34px; border-radius:12px;
  background:var(--accent); color:var(--accent-text);
  display:flex; align-items:center; justify-content:center;
  font-weight:800; font-size:15px;
  flex-shrink:0;
}
.receipt-card{
  background:var(--bg-soft);
  border-radius:var(--radius-xl);
  padding:32px 24px 26px;
  text-align:center;
  margin:10px 0 22px;
}
.receipt-check{
  width:64px; height:64px; border-radius:50%;
  background:var(--accent);
  color:var(--accent-text);
  display:flex; align-items:center; justify-content:center;
  margin:0 auto 18px;
  animation:pop .35s cubic-bezier(.34,1.56,.64,1);
}
.receipt-check svg{ width:32px; height:32px; }
@keyframes pop{ from{ transform:scale(0); } to{ transform:scale(1); } }

.receipt-amount{
  font-weight:800; font-size:30px;
  letter-spacing:-0.03em;
  margin-bottom:6px;
  font-variant-numeric:tabular-nums;
}
.receipt-status{ color:var(--text-2); font-size:14px; margin-bottom:24px; }

.receipt-divider{ height:1px; background:var(--border-strong); margin-bottom:16px; }

.receipt-row{
  display:flex; align-items:flex-start; justify-content:space-between;
  gap:14px; text-align:left;
  font-size:14px; padding:9px 0;
}
.receipt-row span{ color:var(--text-2); flex-shrink:0; }
.receipt-row b{ font-weight:600; text-align:right; }

.receipt-stamp{
  margin-top:22px; padding-top:16px;
  border-top:1px dashed var(--border-strong);
  font-size:10.5px; letter-spacing:.14em;
  color:var(--text-3); font-weight:700;
}

.cards-scroller{
  display:flex; gap:14px;
  overflow-x:auto; -webkit-overflow-scrolling:touch;
  padding:6px 0 22px;
  margin:0 -20px;
  padding-left:20px; padding-right:20px;
  scroll-snap-type:x mandatory;
}
.cards-scroller::-webkit-scrollbar{ display:none; }

.bank-card{
  flex-shrink:0; width:300px; height:186px;
  border-radius:18px; padding:22px;
  display:flex; flex-direction:column; justify-content:space-between;
  background:linear-gradient(135deg, #2A2E38 0%, #15171C 100%);
  color:#fff;
  position:relative; overflow:hidden;
  scroll-snap-align:start;
}
.bank-card::after{
  content:'';
  position:absolute; top:-60px; right:-60px;
  width:180px; height:180px; border-radius:50%;
  background:radial-gradient(circle, rgba(33,160,56,0.35), transparent 70%);
}
.bank-card-top{
  display:flex; justify-content:space-between; align-items:flex-start;
  position:relative; z-index:1;
}
.bank-card-bank{
  font-weight:800; font-size:14px;
  letter-spacing:.12em;
}
.bank-card-network{
  font-size:10px; font-weight:700;
  color:rgba(255,255,255,0.65);
  letter-spacing:.14em;
}
.bank-card-number{
  font-size:17px; letter-spacing:.05em;
  font-weight:600;
  white-space:nowrap;
  position:relative; z-index:1;
  font-variant-numeric:tabular-nums;
}
.bank-card-bottom{
  display:flex; justify-content:space-between; align-items:flex-end;
  position:relative; z-index:1;
}
.bank-card-holder{
  font-size:10.5px; color:rgba(255,255,255,0.75);
  text-transform:uppercase; letter-spacing:.06em;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  max-width:180px;
}
.bank-card-expiry{
  font-size:11px; color:rgba(255,255,255,0.75);
  letter-spacing:.08em;
}

.new-card-cvv{
  background:var(--bg-soft);
  border-radius:var(--radius-lg);
  padding:20px; text-align:center; margin-top:14px;
}
.new-card-cvv p{
  font-size:14px; color:var(--text-2); margin-bottom:12px;
  font-weight:500;
}
.cvv-display{
  font-size:30px; font-weight:800;
  letter-spacing:.24em;
  font-variant-numeric:tabular-nums;
}

.profile-card{
  display:flex; flex-direction:column; align-items:center;
  padding:24px 0 26px; text-align:center;
}
.profile-avatar{
  width:80px; height:80px; border-radius:26px;
  background:var(--accent);
  color:var(--accent-text);
  display:flex; align-items:center; justify-content:center;
  font-size:36px; font-weight:800;
  margin-bottom:16px;
  box-shadow:0 8px 24px var(--accent-soft);
}
.profile-name{ font-weight:800; font-size:20px; margin-bottom:4px; letter-spacing:-0.01em; }
.profile-phone{ color:var(--text-2); font-size:14.5px; }
.profile-login{ color:var(--text-3); font-size:13px; margin-top:2px; }

.profile-list{
  background:var(--bg-soft);
  border-radius:var(--radius-lg);
  padding:2px 18px; margin-bottom:22px;
}
.profile-row{
  display:flex; justify-content:space-between; align-items:center;
  padding:16px 0; font-size:14.5px; color:var(--text-2);
  border-bottom:1px solid var(--border);
  gap:12px;
}
.profile-row:last-child{ border-bottom:none; }
.profile-row b{ color:var(--text); font-weight:600; text-align:right; }

.theme-switch{
  display:grid; grid-template-columns:repeat(3,1fr);
  gap:8px; margin-bottom:22px;
}
.theme-btn{
  background:var(--bg-soft);
  border-radius:var(--radius-md);
  padding:13px 8px;
  font-size:13px; font-weight:600;
  color:var(--text-2);
  transition:background-color .15s ease, color .15s ease;
  border:1.5px solid transparent;
}
.theme-btn.active{
  background:var(--bg);
  color:var(--accent);
  border-color:var(--accent);
  font-weight:700;
}

.bottom-nav{
  position:absolute; left:0; right:0; bottom:0;
  display:flex; align-items:flex-end; justify-content:space-around;
  background:var(--bg);
  border-top:1px solid var(--border);
  padding:8px 6px calc(8px + var(--safe-bottom));
  z-index:5;
}
.bn-item{
  display:flex; flex-direction:column; align-items:center; gap:3px;
  font-size:10.5px; font-weight:600;
  color:var(--text-3);
  padding:6px 8px; flex:1;
  transition:color .15s ease;
}
.bn-item.active{ color:var(--accent); }
.bn-ic{
  width:24px; height:24px;
  display:flex; align-items:center; justify-content:center;
}
.bn-ic svg{ width:23px; height:23px; }
.bn-item-transfer{
  flex:0 0 auto;
  transform:translateY(-16px);
  padding:0;
}
.bn-ic-transfer{
  width:56px; height:56px; border-radius:50%;
  background:var(--accent);
  color:var(--accent-text);
  display:flex; align-items:center; justify-content:center;
  box-shadow:0 10px 24px var(--accent-soft);
}
.bn-ic-transfer svg{ width:26px; height:26px; }

.toast{
  position:fixed;
  left:20px; right:20px;
  top:calc(16px + var(--safe-top));
  background:var(--text);
  color:var(--bg);
  border-radius:var(--radius-md);
  padding:16px 18px;
  font-size:14.5px; font-weight:600;
  transform:translateY(calc(-100% - 30px));
  transition:transform .3s cubic-bezier(.34,1.56,.64,1), opacity .2s ease;
  z-index:100;
  box-shadow:var(--shadow-lg);
  opacity:0;
  pointer-events:none;
}
.toast.show{ transform:translateY(0); opacity:1; }

.modal-overlay{
  position:fixed; inset:0;
  background:rgba(0,0,0,0.5);
  display:flex; align-items:center; justify-content:center;
  padding:24px;
  z-index:200;
}
.modal-overlay[hidden]{ display:none; }

.modal{
  background:var(--bg);
  border-radius:var(--radius-xl);
  padding:26px 22px 20px;
  max-width:340px; width:100%;
  box-shadow:var(--shadow-lg);
}
.modal-title{
  font-size:18px; font-weight:800;
  margin-bottom:10px;
  letter-spacing:-0.01em;
}
.modal-text{
  font-size:14.5px; color:var(--text-2);
  margin-bottom:22px;
  line-height:1.45;
}
.modal-actions{
  display:grid; grid-template-columns:1fr 1fr;
  gap:10px;
}
.modal-actions .btn{
  padding:14px 16px; min-height:48px;
  font-size:15px;
}

@media (min-width:520px){
  .screen{
    max-width:460px; margin:0 auto;
    border-left:1px solid var(--border);
    border-right:1px solid var(--border);
  }
  body{ background:var(--bg-soft); }
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button{
  -webkit-appearance:none;
  margin:0;
}
input[type="number"]{ -moz-appearance:textfield; }

button:focus-visible,
input:focus-visible,
a:focus-visible{
  outline:2px solid var(--accent);
  outline-offset:2px;
  border-radius:var(--radius-sm);
}

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

@media (max-width:360px){
  .quick-actions{ gap:8px; }
  .quick-action{ padding:12px 4px; font-size:11px; }
  .wallet-card{ width:240px; }
  .bank-card{ width:270px; }
  .receipt-amount{ font-size:26px; }
}