:root{
  --bg:#0b0b0d;
  --surface:#17171b;
  --surface-2:#1f1f24;
  --surface-2-hover:#26262c;
  --border:rgba(255,255,255,0.08);
  --border-strong:rgba(255,255,255,0.16);
  --purple:#ab9ff2;
  --purple-hover:#bdb3f6;
  --purple-press:#9a8cee;
  --purple-dim:rgba(171,159,242,0.12);
  --text:#f4f4f6;
  --text-secondary:#94949e;
  --text-tertiary:#5d5d66;
  --green:#3ecf8e;
  --green-dim:rgba(62,207,142,0.12);
  --red:#f37272;
  --red-dim:rgba(243,114,114,0.12);
  --amber:#e8b339;
  --amber-dim:rgba(232,179,57,0.12);
  --radius-lg:20px;
  --radius-md:14px;
  --radius-sm:10px;
  --shadow-card: 0 1px 0 rgba(255,255,255,0.04) inset, 0 20px 50px rgba(0,0,0,0.45);
}
*{ box-sizing:border-box; }
body{
  margin:0;
  min-height:100vh;
  font-family:'Inter', system-ui, -apple-system, sans-serif;
  background:var(--bg);
  color:var(--text);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
  padding-top:max(24px, env(safe-area-inset-top));
  padding-bottom:max(24px, env(safe-area-inset-bottom));
  padding-left:max(20px, env(safe-area-inset-left));
  padding-right:max(20px, env(safe-area-inset-right));
  -webkit-font-smoothing:antialiased;
}
.app{ width:100%; max-width:400px; }

.topbar{
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom:18px; padding:0 2px;
}
.brand{ display:flex; align-items:center; gap:9px; }
.brand-mark{
  width:30px; height:30px; border-radius:9px;
  background:var(--purple);
  display:flex; align-items:center; justify-content:center;
  font-weight:800; font-size:15px; color:#0b0b0d;
}
.brand-name{ font-weight:700; font-size:15px; letter-spacing:-0.1px; }
.network-chip{
  display:flex; align-items:center; gap:6px;
  background:var(--surface-2); border:1px solid var(--border);
  color:var(--text-secondary); font-size:12px; font-weight:600;
  padding:6px 11px; border-radius:999px;
}
.network-chip .dot{ width:6px; height:6px; border-radius:50%; background:var(--green); flex-shrink:0; }

.topbar-right{ display:flex; align-items:center; gap:8px; }
.icon-btn{
  width:32px; height:32px; border-radius:9px;
  background:var(--surface-2); border:1px solid var(--border);
  color:var(--text-secondary); display:flex; align-items:center; justify-content:center;
  cursor:pointer; transition:.15s; flex-shrink:0;
}
.icon-btn:hover{ color:var(--text); border-color:var(--border-strong); }

.card{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--radius-lg);
  padding:28px;
  box-shadow:var(--shadow-card);
}

h1{ font-size:18px; margin:0 0 6px; font-weight:700; letter-spacing:-0.2px; }
.sub{ color:var(--text-secondary); font-size:13.5px; margin:0 0 24px; line-height:1.55; }

.field{ margin-bottom:14px; }
.field label{
  display:block; font-size:12px; font-weight:600; color:var(--text-tertiary);
  text-transform:uppercase; letter-spacing:0.04em; margin-bottom:8px; padding:0 2px;
}
.field input{
  width:100%; background:var(--surface-2); border:1.5px solid transparent;
  border-radius:var(--radius-md); padding:14px 16px; color:var(--text);
  font-size:14.5px; font-family:inherit; outline:none; transition:border-color .15s ease;
}
.field input:focus{ border-color:var(--purple); }
.field input::placeholder{ color:var(--text-tertiary); }
.field-hint{ font-size:11.5px; color:var(--text-tertiary); margin-top:6px; padding:0 2px; }
.field-error{ font-size:12px; color:var(--red); margin-top:6px; padding:0 2px; display:none; }
.field-error.show{ display:block; }

.form-error-banner{
  background:var(--red-dim); color:var(--red); font-size:13px; font-weight:500;
  padding:11px 14px; border-radius:var(--radius-sm); margin-bottom:16px; display:none; line-height:1.5;
}
.form-error-banner.show{ display:block; }

.auth-switch{
  text-align:center; font-size:13px; color:var(--text-secondary); margin-top:18px;
}
.auth-switch button{
  background:none; border:none; color:var(--purple); font-weight:600; font-size:13px;
  cursor:pointer; font-family:inherit; padding:0;
}
.auth-switch button:hover{ color:var(--purple-hover); }

.field-label{
  font-size:12px; font-weight:600; color:var(--text-tertiary);
  text-transform:uppercase; letter-spacing:0.04em;
  margin-bottom:8px; padding:0 2px;
}
.input-group{
  background:var(--surface-2);
  border:1.5px solid transparent;
  border-radius:var(--radius-md);
  padding:16px 18px;
  margin-bottom:12px;
  display:flex; align-items:center; justify-content:space-between;
  transition:border-color .15s ease;
}
.input-group:focus-within{ border-color:var(--purple); }
.input-group input{
  background:none; border:none; outline:none;
  color:var(--text); font-size:28px; font-weight:700;
  width:100%; font-family:inherit; font-variant-numeric:tabular-nums;
  letter-spacing:-0.5px;
}
.input-group input::placeholder{ color:var(--text-tertiary); }
.currency-pill{
  background:var(--border-strong);
  color:var(--text);
  padding:6px 12px; border-radius:999px;
  font-size:12.5px; font-weight:700; white-space:nowrap; flex-shrink:0; margin-left:10px;
}

.quick-amounts{ display:flex; gap:8px; margin-bottom:20px; }
.quick-amounts button{
  flex:1; padding:9px 0; border-radius:var(--radius-sm);
  border:1px solid var(--border); background:transparent;
  color:var(--text-secondary); font-size:13px; font-weight:600; cursor:pointer;
  font-family:inherit; transition:border-color .15s, color .15s, background-color .15s;
}
.quick-amounts button:hover{ border-color:var(--border-strong); color:var(--text); }
.quick-amounts button.active{
  border-color:var(--purple); color:var(--purple); background:var(--purple-dim);
}
.quick-amounts button:focus-visible,
button:focus-visible,
.ghost-btn:focus-visible,
.copy-btn:focus-visible{
  outline:2px solid var(--purple); outline-offset:2px;
}

.estimate{
  display:flex; justify-content:space-between; align-items:center;
  font-size:13px; color:var(--text-secondary);
  padding:0 2px; margin-bottom:16px; min-height:18px;
}
.estimate b{ color:var(--text); font-weight:700; font-variant-numeric:tabular-nums; }
.estimate .spinner{
  width:11px; height:11px; border-radius:50%;
  border:1.5px solid var(--text-tertiary); border-top-color:var(--purple);
  animation:spin .7s linear infinite; display:inline-block;
}
@keyframes spin{ to{ transform:rotate(360deg); } }

.fee-note{
  display:flex; align-items:center; gap:7px;
  font-size:12px; color:var(--text-tertiary);
  margin-bottom:22px; padding:0 2px;
}
.fee-note svg{ flex-shrink:0; color:var(--green); }

button.primary{
  width:100%; padding:15px; border:none; border-radius:var(--radius-md);
  background:var(--purple);
  color:#0b0b0d; font-weight:700; font-size:14.5px; cursor:pointer; font-family:inherit;
  transition:background-color .15s ease, transform .08s ease;
  display:flex; align-items:center; justify-content:center; gap:8px;
}
button.primary:hover:not(:disabled){ background:var(--purple-hover); }
button.primary:active:not(:disabled){ background:var(--purple-press); transform:translateY(1px); }
button.primary:disabled{ opacity:.45; cursor:not-allowed; }
button.primary.is-loading:disabled{ opacity:.9; cursor:wait; }
.ghost-btn:disabled{ opacity:.5; cursor:wait; }

.ghost-btn{
  width:100%; margin-top:10px; padding:13px; border-radius:var(--radius-md);
  border:1px solid var(--border); background:transparent; font-family:inherit;
  color:var(--text-secondary); font-size:13.5px; font-weight:600; cursor:pointer; transition:.15s;
}
.ghost-btn:hover{ color:var(--text); border-color:var(--border-strong); }

.hidden{ display:none !important; }

.status-badge{
  display:inline-flex; align-items:center; gap:8px;
  background:var(--amber-dim); color:var(--amber);
  padding:8px 14px; border-radius:999px;
  font-size:12.5px; font-weight:600;
}
.status-badge.paid{ background:var(--green-dim); color:var(--green); }
.status-badge.error,.status-badge.expired{ background:var(--red-dim); color:var(--red); }
.status-badge .dot{ width:7px; height:7px; border-radius:50%; background:currentColor; animation:pulse 1.8s ease-in-out infinite; }
.status-badge.paid .dot, .status-badge.error .dot, .status-badge.expired .dot{ animation:none; }
@keyframes pulse{ 0%,100%{opacity:1;} 50%{opacity:.35;} }
@media (prefers-reduced-motion: reduce){
  .status-badge .dot, .countdown.danger, .spinner{ animation:none !important; }
}

.status-header{ display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:16px; }

.countdown{
  display:flex; align-items:center; gap:6px;
  font-variant-numeric:tabular-nums;
  font-size:13px; font-weight:600; color:var(--text-secondary);
}
.countdown.warning{ color:var(--amber); }
.countdown.danger{ color:var(--red); }
.countdown svg{ width:13px; height:13px; }

.progress-track{
  height:3px; border-radius:999px; background:var(--surface-2);
  overflow:hidden; margin-bottom:24px;
}
.progress-fill{
  height:100%; border-radius:999px;
  background:var(--purple);
  transition:width 1s linear, background-color .4s;
  width:100%;
}
.progress-fill.warning{ background:var(--amber); }
.progress-fill.danger{ background:var(--red); }

.qr-wrap{ display:flex; justify-content:center; margin-bottom:22px; }
.qr-frame{
  padding:12px; background:#ffffff; border-radius:14px;
  border:1px solid var(--border);
}
.qr-frame img{ display:block; width:160px; height:160px; border-radius:4px; }
.qr-wrap.dimmed .qr-frame{ filter:grayscale(1) brightness(.55); }

.amount-due{ text-align:center; margin-bottom:22px; }
.amount-due .big{ font-size:30px; font-weight:800; letter-spacing:-0.5px; font-variant-numeric:tabular-nums; }
.amount-due .small{ color:var(--text-secondary); font-size:13px; margin-top:3px; }

.addr-box{
  background:var(--surface-2);
  border:1px solid var(--border);
  border-radius:var(--radius-sm);
  padding:13px 15px;
  display:flex; align-items:center; justify-content:space-between;
  gap:10px; margin-bottom:12px;
}
.addr-text{ min-width:0; }
.addr-text .addr-label{ display:block; font-size:11px; color:var(--text-tertiary); font-weight:600; text-transform:uppercase; letter-spacing:0.04em; margin-bottom:3px; }
.addr-text code{ font-size:13px; color:var(--text); font-variant-numeric:tabular-nums; cursor:help; display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.copy-btn{
  flex-shrink:0; background:var(--border-strong); color:var(--text);
  border:none; border-radius:8px; padding:9px 12px; cursor:pointer; font-family:inherit;
  font-size:12px; font-weight:600; transition:background-color .15s; display:flex; align-items:center; gap:6px;
}
.copy-btn:hover{ background:rgba(255,255,255,0.22); }
.copy-btn.copied{ background:var(--green-dim); color:var(--green); }

.network-note{
  display:flex; align-items:flex-start; gap:8px;
  font-size:12px; color:var(--text-tertiary); line-height:1.5;
  padding:0 2px; margin-bottom:18px;
}
.network-note svg{ flex-shrink:0; margin-top:1px; color:var(--text-tertiary); }
.network-note b{ color:var(--text-secondary); font-weight:600; }

.tx-link{
  display:flex; align-items:center; justify-content:center; gap:6px;
  color:var(--purple); font-size:13px; font-weight:600;
  text-decoration:none; padding:11px;
  border-radius:var(--radius-sm); background:var(--purple-dim);
  transition:background-color .15s;
}
.tx-link:hover{ background:rgba(171,159,242,0.2); }

.state-icon{
  width:52px; height:52px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  margin:4px auto 18px;
}
.state-icon.error{ background:var(--red-dim); color:var(--red); }
.state-icon.success{ background:var(--green-dim); color:var(--green); }
.center-text{ text-align:center; }
.center-text h2{ font-size:16.5px; margin:0 0 6px; font-weight:700; letter-spacing:-0.1px; }
.center-text p{ color:var(--text-secondary); font-size:13.5px; margin:0 0 22px; line-height:1.55; }
.center-text .tx-link{ margin-bottom:14px; }

.toast{
  position:fixed; bottom:24px; left:50%; transform:translateX(-50%) translateY(10px);
  background:var(--surface-2); border:1px solid var(--border-strong);
  color:var(--text); padding:11px 18px; border-radius:999px;
  font-size:13px; font-weight:600; box-shadow:0 12px 30px rgba(0,0,0,0.4);
  opacity:0; pointer-events:none; transition:opacity .2s, transform .2s;
  max-width:90vw; text-align:center;
}
.toast.show{ opacity:1; transform:translateX(-50%) translateY(0); }
.toast.error{ background:var(--red-dim); border-color:rgba(243,114,114,0.3); color:var(--red); }

footer{ display:flex; align-items:center; justify-content:center; gap:6px; color:var(--text-tertiary); font-size:11.5px; margin-top:18px; }
footer svg{ flex-shrink:0; }

.offline-banner{
  display:none; align-items:center; gap:8px; justify-content:center;
  background:var(--red-dim); color:var(--red); font-size:12px; font-weight:600;
  padding:9px; border-radius:var(--radius-sm); margin-bottom:14px;
}
.offline-banner.show{ display:flex; }

.balance-card{
  background:linear-gradient(160deg, var(--surface-2), var(--surface));
  border:1px solid var(--border);
  border-radius:var(--radius-md);
  padding:22px 22px 20px;
  margin-bottom:18px;
  text-align:center;
}
.balance-card .label{
  font-size:12px; font-weight:600; color:var(--text-tertiary);
  text-transform:uppercase; letter-spacing:0.04em; margin-bottom:8px;
}
.balance-card .value{
  font-size:34px; font-weight:800; letter-spacing:-0.6px;
  font-variant-numeric:tabular-nums;
}
.balance-card .value .unit{ font-size:16px; color:var(--text-secondary); font-weight:700; margin-left:4px; }
.balance-card .value.loading{ color:var(--text-tertiary); font-size:20px; }

.action-row{ display:flex; gap:10px; margin-bottom:22px; }
.action-row button, .action-row a{
  flex:1; padding:13px 0; border-radius:var(--radius-md);
  border:1px solid var(--border); background:var(--surface-2);
  color:var(--text); font-size:13.5px; font-weight:700; cursor:pointer; font-family:inherit;
  display:flex; flex-direction:column; align-items:center; gap:6px; transition:.15s;
}
.action-row button:hover, .action-row a:hover{ border-color:var(--border-strong); background:var(--surface-2-hover); }
.action-row button.deposit, .action-row a.deposit{ color:var(--green); }
.action-row button.withdraw, .action-row a.withdraw{ color:var(--purple); }
.action-row button svg, .action-row a svg{ width:18px; height:18px; }

.section-title{
  font-size:12px; font-weight:600; color:var(--text-tertiary);
  text-transform:uppercase; letter-spacing:0.04em; margin-bottom:10px; padding:0 2px;
}

.custom-scroll{
  scrollbar-width:thin;
  scrollbar-color:var(--border-strong) transparent;
}
.custom-scroll::-webkit-scrollbar{ width:6px; }
.custom-scroll::-webkit-scrollbar-track{ background:transparent; }
.custom-scroll::-webkit-scrollbar-thumb{
  background:var(--border-strong); border-radius:999px;
}
.custom-scroll::-webkit-scrollbar-thumb:hover{ background:rgba(255,255,255,0.28); }

.history-list{
  display:flex; flex-direction:column; gap:8px;
  max-height:336px; overflow-y:auto;
  padding-right:6px; margin-right:-6px;
  scroll-behavior:smooth;
}
.history-list-fade{ position:relative; }
.history-list-fade::after{
  content:''; position:absolute; left:0; right:6px; bottom:0; height:14px;
  background:linear-gradient(to bottom, transparent, var(--surface));
  pointer-events:none; border-radius:0 0 var(--radius-lg) var(--radius-lg);
  opacity:0; transition:opacity .2s ease;
}
.history-list-fade.has-overflow::after{ opacity:1; }
.history-empty{
  text-align:center; color:var(--text-tertiary); font-size:13px; padding:24px 0;
}
.history-item{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  background:var(--surface-2); border-radius:var(--radius-sm); padding:12px 14px;
}
.history-item .hi-left{ display:flex; align-items:center; gap:10px; min-width:0; }
.history-item .hi-icon{
  width:30px; height:30px; border-radius:9px; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
}
.history-item .hi-icon.in{ background:var(--green-dim); color:var(--green); }
.history-item .hi-icon.out{ background:var(--purple-dim); color:var(--purple); }
.history-item .hi-icon.neutral{ background:var(--border-strong); color:var(--text-secondary); }
.history-item .hi-text{ min-width:0; }
.history-item .hi-title{ font-size:13px; font-weight:600; color:var(--text); }
.history-item .hi-sub{ font-size:11.5px; color:var(--text-tertiary); margin-top:1px; }
.history-item .hi-amount{ font-size:13.5px; font-weight:700; font-variant-numeric:tabular-nums; flex-shrink:0; }
.history-item .hi-amount.in{ color:var(--green); }
.history-item .hi-amount.out{ color:var(--text); }

.back-row{ display:flex; align-items:center; gap:10px; margin-bottom:18px; }
.back-row button{
  width:32px; height:32px; border-radius:9px; flex-shrink:0;
  background:var(--surface-2); border:1px solid var(--border); color:var(--text);
  display:flex; align-items:center; justify-content:center; cursor:pointer; transition:.15s;
}
.back-row button:hover{ border-color:var(--border-strong); }
.back-row h1{ margin:0; }

.balance-available{
  display:flex; justify-content:space-between; align-items:center;
  font-size:13px; color:var(--text-secondary); padding:0 2px; margin-bottom:16px;
}
.balance-available b{ color:var(--text); font-weight:700; font-variant-numeric:tabular-nums; }
.balance-available button{
  background:none; border:none; color:var(--purple); font-weight:600; font-size:12.5px;
  cursor:pointer; font-family:inherit; padding:0;
}

@media (max-width:380px){
  .card{ padding:22px; }
  .amount-due .big{ font-size:26px; }
  .balance-card .value{ font-size:28px; }
  .backup-codes-grid{ grid-template-columns:1fr; }
}
@media (max-width:340px){
  .app{ max-width:100%; }
  .card{ padding:18px; }
  .brand-name{ font-size:13.5px; }
  .network-chip{ padding:5px 9px; font-size:11px; }
  .network-chip span:not(.dot){ display:none; }
  .icon-btn{ width:30px; height:30px; }
  .balance-card .value{ font-size:24px; }
  .balance-card{ padding:18px 16px 16px; }
  .quick-amounts{ flex-wrap:wrap; }
  .quick-amounts button{ flex:1 1 40%; }
  .input-group input{ font-size:24px; }
  .amount-due .big{ font-size:23px; }
  .qr-frame img{ width:140px; height:140px; }
  .tab-bar button{ font-size:11.5px; padding:8px 2px; }
  .settings-info-row{ flex-direction:column; align-items:flex-start; gap:2px; }
  .settings-info-row b{ text-align:left; }
}
@media (max-height:700px){
  body{ align-items:flex-start; padding-top:16px; padding-bottom:16px; }
  .card{ padding:20px; }
  .topbar{ margin-bottom:12px; }
  h1{ margin-bottom:4px; }
  .sub{ margin-bottom:16px; }
  .history-list{ max-height:220px; }
  .qr-frame img{ width:130px; height:130px; }
  footer{ margin-top:12px; }
}
@media (max-height:560px){
  .qr-wrap{ margin-bottom:12px; }
  .qr-frame{ padding:8px; }
  .qr-frame img{ width:104px; height:104px; }
  .progress-track{ margin-bottom:14px; }
  .history-list{ max-height:160px; }
}
@media (hover:none) and (pointer:coarse){
  .copy-btn, .ghost-btn, .icon-btn, button.primary, .tab-bar button{ -webkit-tap-highlight-color:transparent; }
}

@keyframes cardIn{
  from{ opacity:0; transform:translateY(6px) scale(.985); }
  to{ opacity:1; transform:translateY(0) scale(1); }
}
.card{ animation:cardIn .32s cubic-bezier(.22,1,.36,1) both; }

.btn-spinner{
  width:15px; height:15px; border-radius:50%; flex-shrink:0;
  border:2px solid rgba(0,0,0,0.22); border-top-color:#0b0b0d;
  animation:spin .65s linear infinite;
  display:none;
}
.ghost-btn .btn-spinner{ border:2px solid var(--border-strong); border-top-color:var(--text-secondary); }
button.primary.is-loading .btn-spinner,
.ghost-btn.is-loading .btn-spinner{ display:inline-block; }
button.primary.is-loading,
.ghost-btn.is-loading{ cursor:wait; }
button.primary.is-loading{ background:var(--purple-press); }

@keyframes shimmer{
  0%{ background-position:-200px 0; }
  100%{ background-position:200px 0; }
}
.skeleton{
  background:linear-gradient(90deg, var(--surface-2) 25%, var(--surface-2-hover) 37%, var(--surface-2) 63%);
  background-size:400px 100%;
  animation:shimmer 1.3s ease-in-out infinite;
  border-radius:8px;
  color:transparent !important;
}
.balance-card .value.skeleton{
  height:32px; width:140px; margin:0 auto;
}
.history-item.skeleton-item{
  background:var(--surface-2); border-radius:var(--radius-sm); padding:12px 14px;
  display:flex; align-items:center; gap:10px;
}
.history-item.skeleton-item .sk-icon{ width:30px; height:30px; border-radius:9px; flex-shrink:0; }
.history-item.skeleton-item .sk-lines{ flex:1; display:flex; flex-direction:column; gap:6px; }
.history-item.skeleton-item .sk-line{ height:10px; border-radius:6px; }
.history-item.skeleton-item .sk-line.w1{ width:60%; }
.history-item.skeleton-item .sk-line.w2{ width:35%; }
.history-item.skeleton-item .sk-amount{ width:54px; height:13px; border-radius:6px; flex-shrink:0; }

.balance-card .value{ transition:opacity .25s ease; }
.balance-card .value.refreshing{ opacity:.5; }
@keyframes valuePop{
  0%{ transform:scale(1); }
  35%{ transform:scale(1.045); }
  100%{ transform:scale(1); }
}
.balance-card .value.pop{ animation:valuePop .38s cubic-bezier(.22,1,.36,1); }

@keyframes fadeUp{
  from{ opacity:0; transform:translateY(3px); }
  to{ opacity:1; transform:translateY(0); }
}
.estimate b.updated{ animation:fadeUp .22s ease both; }

@keyframes shakeX{
  0%,100%{ transform:translateX(0); }
  20%{ transform:translateX(-4px); }
  40%{ transform:translateX(3px); }
  60%{ transform:translateX(-2px); }
  80%{ transform:translateX(1px); }
}
.form-error-banner.show{ animation:bannerIn .2s ease both, shakeX .32s ease-in-out .05s; }
@keyframes bannerIn{
  from{ opacity:0; max-height:0; padding-top:0; padding-bottom:0; margin-bottom:0; }
  to{ opacity:1; max-height:60px; }
}
.field-error.show{ animation:fadeUp .18s ease both; }

.status-badge{ transition:background-color .35s ease, color .35s ease; }
@keyframes badgePop{
  0%{ transform:scale(.92); opacity:.6; }
  60%{ transform:scale(1.03); }
  100%{ transform:scale(1); opacity:1; }
}
.status-badge.pop{ animation:badgePop .35s cubic-bezier(.22,1,.36,1); }

.qr-frame img{ opacity:0; transition:opacity .35s ease; }
.qr-frame img.loaded{ opacity:1; }

.state-icon{ transform:scale(0); }
.state-icon.animate{ animation:stateIconPop .45s cubic-bezier(.34,1.56,.64,1) both; }
@keyframes stateIconPop{
  from{ transform:scale(0); opacity:0; }
  to{ transform:scale(1); opacity:1; }
}
.state-icon svg path, .state-icon svg circle{
  stroke-dasharray:60; stroke-dashoffset:60;
}
.state-icon.animate svg path, .state-icon.animate svg circle{
  animation:drawStroke .5s ease-out .15s forwards;
}
@keyframes drawStroke{ to{ stroke-dashoffset:0; } }
.state-icon.error.animate{ animation:stateIconPop .45s cubic-bezier(.34,1.56,.64,1) both, errorShake .4s ease-in-out .45s; }
@keyframes errorShake{
  0%,100%{ transform:scale(1) translateX(0); }
  25%{ transform:scale(1) translateX(-3px); }
  75%{ transform:scale(1) translateX(3px); }
}
.state-icon.success.animate{
  box-shadow:0 0 0 0 var(--green-dim);
  animation:stateIconPop .45s cubic-bezier(.34,1.56,.64,1) both, successRing 1s ease-out .35s;
}
@keyframes successRing{
  0%{ box-shadow:0 0 0 0 rgba(62,207,142,.45); }
  100%{ box-shadow:0 0 0 14px rgba(62,207,142,0); }
}

@keyframes copiedPop{
  0%{ transform:scale(.85); }
  60%{ transform:scale(1.08); }
  100%{ transform:scale(1); }
}
.copy-btn.copied{ animation:copiedPop .3s cubic-bezier(.34,1.56,.64,1); }

@keyframes itemIn{
  from{ opacity:0; transform:translateY(4px); }
  to{ opacity:1; transform:translateY(0); }
}
.history-item:not(.skeleton-item){ animation:itemIn .28s ease both; }

.settings-info-box{
  background:var(--surface-2); border:1px solid var(--border);
  border-radius:var(--radius-md); padding:4px 16px; margin-bottom:4px;
}
.settings-info-row{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:13px 0; font-size:13px; color:var(--text-secondary);
  border-bottom:1px solid var(--border);
}
.settings-info-row:last-child{ border-bottom:none; }
.settings-info-row b{ color:var(--text); font-weight:600; font-size:13px; text-align:right; overflow:hidden; text-overflow:ellipsis; }

.twofa-status-row{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  background:var(--surface-2); border:1px solid var(--border);
  border-radius:var(--radius-md); padding:14px 16px;
}
.twofa-status-text{ display:flex; align-items:center; font-size:13.5px; font-weight:600; color:var(--text); }
.status-dot{ width:8px; height:8px; border-radius:50%; background:var(--text-tertiary); display:inline-block; margin-right:9px; flex-shrink:0; }
.status-dot.on{ background:var(--green); }
.ghost-btn-sm{
  flex-shrink:0; background:var(--border-strong); color:var(--text);
  border:none; border-radius:8px; padding:8px 14px; cursor:pointer; font-family:inherit;
  font-size:12.5px; font-weight:600; transition:background-color .15s;
}
.ghost-btn-sm:hover{ background:rgba(255,255,255,0.22); }

.twofa-setup, .twofa-disable{
  margin-top:14px; padding-top:14px; border-top:1px solid var(--border);
}
.backup-codes{ margin-top:4px; }
.backup-codes-grid{
  display:grid; grid-template-columns:1fr 1fr; gap:8px;
}
.backup-code{
  background:var(--surface-2); border:1px solid var(--border);
  border-radius:8px; padding:9px 10px; text-align:center;
  font-size:12.5px; font-variant-numeric:tabular-nums; color:var(--text);
  letter-spacing:0.02em;
}

button.primary.danger{ background:var(--red); color:#1a0a0a; }
button.primary.danger:hover:not(:disabled){ background:#f58c8c; }
button.primary.danger:active:not(:disabled){ background:#ee6b6b; }
button.primary.danger.is-loading{ background:#ee6b6b; }

.tab-bar{
  display:flex; gap:4px; background:var(--surface-2);
  border:1px solid var(--border); border-radius:999px;
  padding:4px; margin-bottom:24px;
}
.tab-bar button{
  flex:1; border:none; background:transparent; font-family:inherit;
  color:var(--text-secondary); font-size:12.5px; font-weight:600;
  padding:9px 4px; border-radius:999px; cursor:pointer;
  transition:background-color .15s, color .15s; white-space:nowrap;
}
.tab-bar button:hover{ color:var(--text); }
.tab-bar button.active{ background:var(--purple); color:#0b0b0d; }
.tab-bar button:focus-visible{ outline:2px solid var(--purple); outline-offset:2px; }
.tab-panel{ display:none; }
.tab-panel.active{ display:block; animation:fadeUp .22s ease both; }

.password-wrap{ position:relative; }
.password-wrap input{ padding-right:42px; }
.pw-toggle{
  position:absolute; right:2px; top:50%; transform:translateY(-50%);
  background:none; border:none; color:var(--text-tertiary);
  cursor:pointer; padding:9px 10px; display:flex; align-items:center;
  justify-content:center; border-radius:8px; transition:color .15s;
}
.pw-toggle:hover{ color:var(--text-secondary); }
.pw-toggle .eye-hide{ display:none; }
.pw-toggle.shown .eye-show{ display:none; }
.pw-toggle.shown .eye-hide{ display:block; }

@media (prefers-reduced-motion: reduce){
  *{ animation-duration:.001s !important; animation-iteration-count:1 !important; transition-duration:.001s !important; }
}
