:root{
  --bg: #f6f8fb;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #e7edf5;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  --shadow-sm: 0 6px 18px rgba(15, 23, 42, 0.06);
  --radius: 14px;
  --radius-sm: 12px;
  --blue: #2563eb;
  --blue-2: #1d4ed8;
  --green: #16a34a;
  --green-bg: rgba(22, 163, 74, 0.10);
  --ghost-bg: rgba(148, 163, 184, 0.12);
}

*{ box-sizing: border-box; }
html, body{ height: 100%; }
body{
  margin:0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a{ color: inherit; text-decoration: none; }
button, input{ font: inherit; }

.app{
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.topbar__menu{
  display:none;
}

.overlay{
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.45);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
  z-index: 90;
}

body.is-nav-open .overlay{
  opacity: 1;
  pointer-events: auto;
}

body.is-nav-open{
  overflow: hidden;
}

.sidebar{
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 18px 16px;
  display:flex;
  flex-direction: column;
  gap: 16px;
}

.brand{
  display:flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
}
.brand__mark{
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2b6cff, #2c3cff);
  color: #fff;
  display:flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.brand__name{
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 18px;
}

.nav-section{ display:flex; flex-direction: column; gap: 10px; }
.nav-section__title{
  padding: 4px 12px;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.nav{ display:flex; flex-direction: column; gap: 6px; }
.nav__item{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  color: #1f2937;
  position: relative;
}
.nav__item:hover{ background: rgba(148, 163, 184, 0.12); }
.nav__item.is-active{
  background: rgba(37, 99, 235, 0.08);
  color: #0b255e;
}
.nav__item.is-disabled{
  opacity: .55;
  cursor: not-allowed;
}
.nav__icon{
  width: 18px; height: 18px;
  color: #64748b;
  display:inline-flex;
}
.nav__item.is-active .nav__icon{ color: var(--blue); }
.nav__icon svg{ width: 18px; height: 18px; }
.nav__label{ font-weight: 600; font-size: 13px; }
/* Sidebar balance badges removed (balances moved to topbar). */
.nav__badge{ display:none; }

.pill{
  margin-left: auto;
  font-size: 11px;
  color: #334155;
  background: rgba(148, 163, 184, 0.14);
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 600;
}

.sidebar__spacer{ flex: 1; }

.support-card{
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  display:flex;
  flex-direction: column;
  gap: 10px;
  background: #fbfdff;
}

/* Rates widget (replaces support card content) */
.rates__head{
  display:flex;
  align-items:flex-start;
  justify-content: space-between;
  gap: 10px;
}
.rates__title{
  font-weight: 900;
  font-size: 13px;
  color: #0f172a;
}
.rates__meta{
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}
.rates__list{
  display:flex;
  flex-direction: column;
  gap: 6px;
  max-height: 180px;
  overflow: auto;
  padding-right: 4px;
}
.rates__row{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px;
  border: 1px solid rgba(231, 237, 245, 0.9);
  border-radius: 12px;
  background: #fff;
}
.rates__code{
  font-weight: 900;
  font-size: 12px;
  color: #0f172a;
}
.rates__val{
  font-weight: 900;
  font-size: 12px;
  color: #0f172a;
}
.rates__source{
  margin-top: 2px;
  font-size: 12px;
  font-weight: 800;
  color: var(--blue);
  text-decoration: none;
}
.rates__source:hover{ text-decoration: underline; }
.rates__skeleton{
  height: 110px;
  border-radius: 12px;
  border: 1px dashed #d9e2ef;
  background: linear-gradient(90deg, rgba(148,163,184,0.08), rgba(148,163,184,0.18), rgba(148,163,184,0.08));
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}

/* Settings page */
.settings-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.settings-card{
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 14px;
  display:flex;
  flex-direction: column;
  gap: 8px;
}
.settings-card__title{
  font-weight: 900;
  font-size: 14px;
}
.settings-card__sub{
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.settings-row{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
}
.settings-value{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-weight: 900;
  font-size: 13px;
  color: #0f172a;
  background: rgba(148, 163, 184, 0.10);
  border: 1px solid rgba(148, 163, 184, 0.18);
  padding: 8px 10px;
  border-radius: 12px;
  min-width: 0;
  overflow: auto;
  text-overflow: clip;
  white-space: normal;
  word-break: break-all;
  max-width: 100%;
}
.settings-actions{
  display:flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.settings-hint{
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.settings-form{
  display:flex;
  gap: 10px;
  align-items:center;
}
.settings-form .auth__input{
  flex: 1;
}

.settings-toggle{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  background: rgba(148, 163, 184, 0.06);
}
.settings-toggle__meta{
  display:flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.settings-toggle__label{
  font-weight: 900;
  font-size: 13px;
}
.settings-toggle__hint{
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

/* Switch */
.switch{
  position: relative;
  display:inline-flex;
  align-items:center;
  cursor:pointer;
  user-select:none;
}
.switch input{
  position:absolute;
  opacity:0;
  width:1px;
  height:1px;
}
.switch__track{
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.35);
  border: 1px solid rgba(148, 163, 184, 0.35);
  position: relative;
  transition: background .18s ease, border-color .18s ease;
}
.switch__track::after{
  content:"";
  position:absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.18);
  transition: transform .18s ease;
}
.switch input:checked + .switch__track{
  background: rgba(37, 99, 235, 0.9);
  border-color: rgba(37, 99, 235, 0.9);
}
.switch input:checked + .switch__track::after{
  transform: translateX(20px);
}
.switch input:disabled + .switch__track{
  opacity: .55;
  cursor: not-allowed;
}

/* Wallet modals (deposit/send) */
.qr-box{
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1 / 1;
  margin: 6px auto 4px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: #fff;
  box-shadow: var(--shadow-sm);
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
}
.qr-box__ph{
  width: 78%;
  height: 78%;
  border-radius: 14px;
  background:
    linear-gradient(90deg, rgba(148,163,184,.18) 25%, rgba(148,163,184,.28) 37%, rgba(148,163,184,.18) 63%);
  background-size: 400% 100%;
  animation: ratesShimmer 1.2s ease infinite;
  display:flex;
  align-items:center;
  justify-content:center;
  color: rgba(15, 23, 42, 0.55);
  font-weight: 900;
  letter-spacing: .08em;
}
.addr-row{
  margin-top: 12px;
  display:flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(148, 163, 184, 0.06);
}
.addr-row__meta{
  min-width: 0;
  display:flex;
  flex-direction: column;
  gap: 4px;
}
.addr-value{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-weight: 900;
  font-size: 12px;
  word-break: break-all;
  color: #0f172a;
}

@media (max-width: 520px){
  .addr-row{ flex-direction: column; align-items: stretch; }
  .addr-row .btn{ width: 100%; justify-content: center; }
}

@media (max-width: 960px){
  .settings-grid{ grid-template-columns: 1fr; }
  .settings-row{ flex-direction: column; align-items: stretch; }
  .settings-row .btn{ width: 100%; justify-content: center; }
  .settings-actions{ justify-content: stretch; }
  .settings-form{ flex-direction: column; align-items: stretch; }
  .settings-form .btn{ width: 100%; justify-content: center; }
}
@keyframes shimmer{
  0%{ background-position: 0% 0; }
  100%{ background-position: 200% 0; }
}

/* Modal */
.modal{
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
}
.modal.is-open,
.modal--show{ display: block; }
.modal__overlay{
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.45);
  backdrop-filter: blur(2px);
}
.modal__dialog{
  position: relative;
  width: min(560px, calc(100vw - 28px));
  margin: 10vh auto 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 14px;
}
.modal__head{
  display:flex;
  align-items:flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.modal__title{
  font-weight: 900;
  font-size: 16px;
  letter-spacing: -0.02em;
}
.modal__subtitle{
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.modal__form{
  display:flex;
  flex-direction: column;
  gap: 10px;
}
.modal__actions,
.modal__foot{
  display:flex;
  justify-content:flex-end;
  gap: 10px;
  margin-top: 4px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.modal__error{
  border: 1px solid rgba(239, 68, 68, 0.25);
  background: rgba(239, 68, 68, 0.08);
  color: #7f1d1d;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 12px;
}

/* Confirm transaction modal */
.confirm-tx-info{
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 8px 0;
}
.confirm-tx-row{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.confirm-tx-row:last-child{
  border-bottom: none;
}
.confirm-tx-label{
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: -0.01em;
}
.confirm-tx-value{
  font-size: 15px;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -0.02em;
  text-align: right;
}
.confirm-tx-value--highlight{
  color: var(--blue);
  font-size: 16px;
}

/* Work status pill */
.work-pill{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 11px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.work-pill::before{
  content:"";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  display:inline-block;
}
.work-pill--on{
  background: rgba(22, 163, 74, 0.10);
  border-color: rgba(22, 163, 74, 0.18);
  color: #166534;
}
.work-pill--on::before{
  background: #16a34a;
  box-shadow: 0 0 0 3px rgba(22,163,74,.12);
}
.work-pill--off{
  background: rgba(239, 68, 68, 0.10);
  border-color: rgba(239, 68, 68, 0.18);
  color: #7f1d1d;
}
.work-pill--off::before{
  background: #ef4444;
  box-shadow: 0 0 0 3px rgba(239,68,68,.12);
}

@media (max-width: 560px){
  .modal__dialog{ margin-top: 8vh; }
  .modal__actions{ flex-direction: column-reverse; }
  .modal__actions .btn{ width: 100%; justify-content: center; }
}

/* Toast notifications */
.toast-container{
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast{
  pointer-events: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 280px;
  max-width: 400px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: toastSlideIn 0.3s ease-out;
}
.toast--success{
  border-color: rgba(22, 163, 74, 0.25);
  background: rgba(22, 163, 74, 0.05);
}
.toast--error{
  border-color: rgba(239, 68, 68, 0.25);
  background: rgba(239, 68, 68, 0.05);
}
.toast__icon{
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 2px;
}
.toast__content{
  flex: 1;
}
.toast__title{
  font-weight: 900;
  font-size: 13px;
  color: #0f172a;
  margin-bottom: 2px;
}
.toast--success .toast__title{
  color: #166534;
}
.toast--error .toast__title{
  color: #7f1d1d;
}
.toast__message{
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}
.toast__close{
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  opacity: 0.5;
  transition: opacity 0.2s;
}
.toast__close:hover{
  opacity: 1;
}
@keyframes toastSlideIn{
  from{
    transform: translateX(100%);
    opacity: 0;
  }
  to{
    transform: translateX(0);
    opacity: 1;
  }
}
@media (max-width: 560px){
  .toast-container{
    top: 10px;
    right: 10px;
    left: 10px;
  }
  .toast{
    min-width: auto;
    max-width: none;
  }
}
.support-card__status{
  display:flex;
  align-items:center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.dot{
  width: 8px; height: 8px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34,197,94,.15);
}
.support-card__title{ font-weight: 700; font-size: 13px; }
.support-card__text{ font-size: 12px; color: var(--muted); line-height: 1.35; }

.profile{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fff;
}
.avatar{
  width: 34px; height: 34px;
  border-radius: 12px;
  background: rgba(37, 99, 235, 0.10);
  color: var(--blue);
  font-weight: 800;
  display:flex;
  align-items:center;
  justify-content: center;
  font-size: 12px;
}
.profile__name{ font-weight: 700; font-size: 13px; }
.profile__email{ font-size: 12px; color: var(--muted); }

.main{
  display:flex;
  flex-direction: column;
  min-width: 0;
}

.topbar{
  height: 64px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content: space-between;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar__left{
  display:flex;
  align-items:center;
  gap: 12px;
  min-width: 0;
}

.crumbs{
  display:flex;
  align-items:center;
  gap: 10px;
  color: var(--muted);
}
.crumbs__icon{
  width: 26px; height: 26px;
  border-radius: 10px;
  background: rgba(37, 99, 235, 0.10);
  color: var(--blue);
  display:inline-flex;
  align-items:center;
  justify-content: center;
}
.crumbs__icon svg{ width: 16px; height: 16px; }
.crumbs__link{
  font-weight: 700;
  color: #1f2937;
  font-size: 13px;
  line-height: 1.2;
}
.crumbs__sep{ color: #cbd5e1; }
.crumbs__current{ font-size: 13px; color: var(--muted); font-weight: 600; }

.topbar__actions{ display:flex; gap: 10px; position: relative; }

/* Topbar balances (moved from sidebar badges) */
.topbar__balances{
  display:flex;
  gap: 8px;
  align-items:center;
  margin-right: 4px;
  min-width: 0;
}
.topbar__bal{
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(148, 163, 184, 0.08);
  font-weight: 900;
  font-size: 12px;
  color: #0f172a;
  white-space: nowrap;
  min-width: 0;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.topbar__bal--cards{ display: none; }
.is-trader .topbar__bal--cards{ display: inline-flex; }

@media (max-width: 520px){
  .topbar__balances{ gap: 6px; }
  .topbar__bal{ padding: 7px 9px; font-size: 11px; }
}

@media (max-width: 420px){
  /* Keep header on one line: show only wallet balance on very small screens */
  .is-trader .topbar__bal--cards{ display: none !important; }
  .topbar__bal{ max-width: 115px; padding: 6px 8px; }
  .topbar__actions{ gap: 8px; }
  .icon-btn{ width: 34px; height: 34px; border-radius: 11px; }
  .icon-btn svg{ width: 17px; height: 17px; }
}

@media (max-width: 360px){
  .topbar__bal{ max-width: 95px; }
}

/* Role-gated navigation: hide Cards until role is confirmed (prevents flash). */
.nav__item--cards{ display: none !important; }
.is-trader .nav__item--cards{ display: flex !important; }

/* Gear dropdown menu */
.user-menu{
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(2, 6, 23, 0.12);
  padding: 6px;
  z-index: 50;
  display: none;
}
.user-menu.is-open{ display: block; }
.user-menu__item{
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  color: #0f172a;
  text-decoration: none;
  font-weight: 800;
  font-size: 13px;
}
.user-menu__item:hover{
  background: rgba(148, 163, 184, 0.12);
}
.user-menu__item svg{ width: 16px; height: 16px; color: #64748b; }

.icon-btn{
  width: 38px; height: 38px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  color: #64748b;
  cursor:pointer;
}
.icon-btn:hover{
  background: rgba(148, 163, 184, 0.12);
}
.icon-btn:disabled{
  opacity: .45;
  cursor: not-allowed;
  background: #fff;
}
.icon-btn:disabled:hover{ background: #fff; }
.icon-btn svg{ width: 18px; height: 18px; }

.content{
  padding: 18px 22px 28px;
}

.balance{
  display:flex;
  flex-direction: column;
  gap: 6px;
  margin: 6px 0 16px;
}
.balance__label{
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.balance__value{
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.balance__meta{
  margin-top: 6px;
  display:flex;
  flex-wrap: wrap;
  gap: 8px;
}

.page-head{
  display:flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 10px 0 16px;
}
.page-title{
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.02em;
}
.page-subtitle{
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.btn{
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  display:inline-flex;
  align-items:center;
  gap: 8px;
}
.btn--primary{
  background: var(--blue);
  color: #fff;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.20);
}
.btn--primary:hover{ background: var(--blue-2); }
.btn__plus{
  width: 20px; height: 20px;
  border-radius: 8px;
  background: rgba(255,255,255,0.18);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-weight: 900;
  line-height: 1;
}
.btn--ghost{
  background: rgba(148, 163, 184, 0.14);
  border-color: rgba(148, 163, 184, 0.14);
  color: #0f172a;
}
.btn--ghost:hover{
  background: rgba(148, 163, 184, 0.20);
}

.btn--sm{
  padding: 8px 12px;
  border-radius: 12px;
}
.btn--with-icon .btn-ic{
  width: 18px; height: 18px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.btn--with-icon .btn-ic svg{ width: 18px; height: 18px; }

.balance-row{
  display:flex;
  align-items:flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 6px;
}
.balance-row__actions{
  display:flex;
  align-items:center;
  gap: 10px;
  margin-top: 10px;
}

.section-head{
  display:flex;
  align-items:flex-start;
  justify-content: space-between;
  gap: 14px;
  margin: 14px 0 12px;
}
.section-title{
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.section-subtitle{
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.toolbar{
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.search{
  flex: 1;
  min-width: 260px;
  display:flex;
  align-items:center;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid #eef2f7;
  border-radius: 12px;
  padding: 10px 12px;
}
.search__icon{ width: 18px; height: 18px; color: #94a3b8; }
.search__icon svg{ width: 18px; height: 18px; }
.search__input{
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-size: 13px;
  color: #0f172a;
}
.search__input::placeholder{ color: #94a3b8; }

.toolbar__right{ display:flex; align-items:center; gap: 10px; }
.chip{
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 700;
  font-size: 13px;
  color: #0f172a;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  gap: 10px;
}
.chip:hover{ background: rgba(148, 163, 184, 0.12); }
.chip__kbd{
  font-size: 11px;
  color: #475569;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  padding: 2px 6px;
  border-radius: 8px;
  font-weight: 700;
}

.chip--sm{
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.chips-row{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0 10px;
}
.chips-row__left{
  display:flex;
  align-items:center;
  gap: 8px;
  flex-wrap: wrap;
}

.table-card{
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table{
  width: 100%;
  border-collapse: collapse;
}
.table thead th{
  text-align: left;
  font-size: 11px;
  letter-spacing: .02em;
  color: #94a3b8;
  font-weight: 800;
  padding: 12px 14px;
  background: #fbfdff;
  border-bottom: 1px solid var(--line);
}
.table tbody td{
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table tbody tr:hover{
  background: rgba(148, 163, 184, 0.08);
}
.table tbody tr:last-child td{ border-bottom: none; }
.th-right, .td-right{ text-align: right; }

.cell-main{
  display:flex;
  align-items:center;
  gap: 12px;
}
.cell-stack{
  display:flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.cell-title{
  font-weight: 800;
  font-size: 12px;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.txid-link{
  color: #0f172a;
  text-decoration: none;
}
.txid-link:hover{
  text-decoration: underline;
}
.cell-sub{
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-ic{
  width: 34px; height: 34px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  border: 1px solid rgba(148, 163, 184, 0.18);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  color: #64748b;
  flex: 0 0 auto;
}
.row-ic svg{ width: 16px; height: 16px; }

.method-ic{
  width: 28px; height: 28px;
  border-radius: 10px;
  background: rgba(37, 99, 235, 0.10);
  border: 1px solid rgba(37, 99, 235, 0.14);
  color: var(--blue);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  flex: 0 0 auto;
}
.method-ic svg{ width: 16px; height: 16px; }

.mini-tag{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 4px 8px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(148, 163, 184, 0.10);
  color: #334155;
  font-weight: 800;
  font-size: 11px;
}

.is-chip-active{
  background: rgba(37, 99, 235, 0.10);
  border-color: rgba(37, 99, 235, 0.22);
  color: #0b255e;
}

.visa-badge{
  width: 38px;
  height: 24px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: #fff;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-weight: 900;
  font-size: 10px;
  color: #111827;
  letter-spacing: .02em;
  flex: 0 0 auto;
}

.status-pill{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 11px;
  border: 1px solid transparent;
}
.status-dot{
  width: 7px; height: 7px;
  border-radius: 999px;
}
.status--ok{
  background: rgba(22, 163, 74, 0.10);
  border-color: rgba(22, 163, 74, 0.18);
  color: #166534;
}
.status--ok .status-dot{
  background: #16a34a;
  box-shadow: 0 0 0 3px rgba(22,163,74,.12);
}
.status--pending{
  background: rgba(234, 179, 8, 0.14);
  border-color: rgba(234, 179, 8, 0.20);
  color: #854d0e;
}
.status--pending .status-dot{
  background: #eab308;
  box-shadow: 0 0 0 3px rgba(234,179,8,.12);
}
.status--bad{
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.20);
  color: #7f1d1d;
}
.status--bad .status-dot{
  background: #ef4444;
  box-shadow: 0 0 0 3px rgba(239,68,68,.12);
}

.amt{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap: 10px;
}
.amt--stack{ align-items:flex-start; }
.amt__stack{
  display:flex;
  flex-direction: column;
  align-items:flex-end;
  gap: 2px;
}
.amt__sub{
  font-size: 11px;
  color: #94a3b8;
  font-weight: 700;
  white-space: nowrap;
}
.amt__main{
  font-weight: 900;
  font-size: 12px;
  color: #0f172a;
  white-space: nowrap;
}
.amt__main.is-neg{ color: #111827; }
.amt__main.is-pos{ color: #111827; }
.amt-arrow{
  width: 20px; height: 20px;
  border-radius: 10px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-weight: 900;
  font-size: 12px;
}
.amt-arrow--down{
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
}
.amt-arrow--up{
  background: rgba(22, 163, 74, 0.12);
  color: #166534;
}

.filters{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0 14px;
  padding: 0 2px;
}
.filters__left{
  display:flex;
  align-items:center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}
.filters__hint{ font-weight: 700; color: #94a3b8; }
.filters__dot{ color: #cbd5e1; }

.linkish{
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  font-size: 12px;
  color: #475569;
  font-weight: 700;
}
.linkish:hover{ color: #0f172a; }
.linkish--muted{ color: #94a3b8; font-weight: 700; }
.linkish--muted:hover{ color: #64748b; }

.cards-grid{
  display:grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-top: 6px;
}

.card{
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
  display:flex;
  flex-direction: column;
  gap: 10px;
}
.card.is-clickable{
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}
.card.is-clickable:hover{
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.10);
  border-color: rgba(37, 99, 235, 0.25);
}
.card__top{
  display:flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.card__meta{
  display:flex;
  align-items:center;
  gap: 8px;
  flex-wrap: wrap;
}
.tag{
  display:inline-flex;
  align-items:center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 800;
  border: 1px solid transparent;
}
.tag--ghost{
  background: var(--ghost-bg);
  color: #475569;
  border-color: rgba(148, 163, 184, 0.18);
}
.tag--ok{
  background: var(--green-bg);
  color: #166534;
  border-color: rgba(22, 163, 74, 0.18);
}
.tag--bad{
  background: rgba(239, 68, 68, 0.12);
  color: #7f1d1d;
  border-color: rgba(239, 68, 68, 0.20);
}
.tag--bad .tag__dot{
  background: #ef4444;
  box-shadow: 0 0 0 3px rgba(239,68,68,.12);
}
.tag__dot{
  width: 7px; height: 7px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(22,163,74,.12);
}
.card__contactless{
  width: 24px; height: 24px;
  color: #cbd5e1;
}
.card__contactless svg{ width: 24px; height: 24px; }
.card__name{
  font-weight: 800;
  font-size: 13px;
  letter-spacing: -0.01em;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card__number{
  font-size: 12px;
  color: #64748b;
  font-weight: 600;
}
.card__bottom{
  display:flex;
  align-items:flex-end;
  justify-content: space-between;
  margin-top: 8px;
}
.card__amount{
  font-weight: 900;
  letter-spacing: -0.01em;
  font-size: 14px;
}
.card__brand{
  font-weight: 900;
  font-size: 12px;
  color: #111827;
  opacity: .85;
}

.card.is-hidden{ display:none; }

.empty-state{
  grid-column: 1 / -1;
  border: 1px dashed #d9e2ef;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.7);
  padding: 18px;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

/* Auth pages (Flask /login, /verify) */
.auth-body{
  background: radial-gradient(1200px 500px at 50% -10%, rgba(37, 99, 235, 0.12), transparent 60%), var(--bg);
}
.auth{
  min-height: 100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 22px;
}
.auth__card{
  width: min(520px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 18px 18px 16px;
}
.auth__brand{
  display:flex;
  align-items:center;
  gap: 10px;
  margin-bottom: 10px;
}
.auth__brand-name{
  font-weight: 900;
  letter-spacing: -0.02em;
}
.auth__title{
  margin: 6px 0 4px;
  font-size: 20px;
  letter-spacing: -0.02em;
}
.auth__subtitle{
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 12px;
}
.auth__error{
  border: 1px solid rgba(239, 68, 68, 0.25);
  background: rgba(239, 68, 68, 0.08);
  color: #7f1d1d;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 13px;
  margin: 10px 0 12px;
}
.auth__form{
  display:flex;
  flex-direction: column;
  gap: 10px;
}
.auth__label{
  font-size: 12px;
  font-weight: 800;
  color: #334155;
  display:flex;
  flex-direction: column;
  gap: 6px;
}
.auth__input{
  border: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 12px;
  padding: 12px 12px;
  font-size: 14px;
  outline: none;
}
.auth__input:focus{
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}
.auth__btn{ width: 100%; justify-content: center; }
.auth__hint{
  font-size: 13px;
  color: var(--muted);
  margin: 6px 0 10px;
}
.auth__links{
  margin-top: 10px;
  display:flex;
  justify-content: center;
}

/* Referrals page bits */
.ref-block{
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
  padding: 14px;
  margin-bottom: 14px;
}
.ref-block__label{ font-weight: 900; font-size: 13px; }
.ref-block__hint{ margin-top: 4px; color: var(--muted); font-size: 12px; }
.how{ margin: 6px 0 18px; }
.how__title{ font-weight: 900; font-size: 14px; }
.how__sub{ color: var(--muted); font-size: 12px; margin-top: 3px; }
.how__steps{ margin-top: 10px; display:flex; flex-direction: column; gap: 10px; }
.how__step{ display:flex; gap: 10px; align-items:flex-start; }
.how__ic{
  width: 28px; height: 28px;
  border-radius: 10px;
  background: rgba(37, 99, 235, 0.10);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size: 14px;
}
.how__step-title{ font-weight: 900; font-size: 13px; }
.how__step-sub{ color: var(--muted); font-size: 12px; margin-top: 2px; line-height: 1.35; }
.ref-actions{ display:flex; align-items:center; gap: 10px; }
.empty-panel{
  padding: 26px 18px;
  display:flex;
  flex-direction: column;
  align-items:center;
  justify-content:center;
  gap: 6px;
  color: var(--muted);
}
.empty-panel__ic{
  width: 40px; height: 40px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(148, 163, 184, 0.10);
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.empty-panel__title{ font-weight: 900; color: #0f172a; }
.empty-panel__sub{ font-weight: 700; font-size: 12px; text-align:center; max-width: 420px; }

.pager{
  display:flex;
  align-items:center;
  justify-content: space-between;
  margin-top: 16px;
  gap: 12px;
}
.pager__sizes{ display:flex; gap: 8px; flex-wrap: wrap; }
.pager-pill{
  border: 1px solid var(--line);
  background: #fff;
  padding: 6px 8px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 11px;
  color: #475569;
  cursor:pointer;
}
.pager-pill:hover{ background: rgba(148, 163, 184, 0.12); }
.pager-pill.is-active{
  background: rgba(37, 99, 235, 0.10);
  border-color: rgba(37, 99, 235, 0.22);
  color: #0b255e;
}
.pager__nav{ display:flex; align-items:center; gap: 10px; }
.pager__info{
  font-size: 12px;
  font-weight: 800;
  color: #475569;
  padding: 0 6px;
}

@media (max-width: 1400px){
  .cards-grid{ grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1200px){
  .app{ grid-template-columns: 260px 1fr; }
  .cards-grid{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 960px){
  .app{ grid-template-columns: 1fr; }
  .topbar__menu{ display:inline-flex; }
  .sidebar{
    display:flex;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: min(320px, 86vw);
    z-index: 100;
    transform: translateX(-105%);
    transition: transform 220ms ease;
    box-shadow: 0 30px 60px rgba(15, 23, 42, 0.22);
  }
  body.is-nav-open .sidebar{
    transform: translateX(0);
  }
  .main{ min-width: 0; }
  .cards-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar{ position: static; }
  .balance-row{ flex-direction: column; align-items: stretch; }
  .balance-row__actions{ margin-top: 0; flex-wrap: wrap; }

  .chips-row{
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
  .chips-row__left{ flex-wrap: nowrap; }
  .chips-row__left .chip{ white-space: nowrap; }

  .table-card{
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .table{
    min-width: 860px;
  }
}
@media (max-width: 560px){
  .cards-grid{ grid-template-columns: 1fr; }
  .toolbar{ flex-direction: column; align-items: stretch; }
  .toolbar__right{ justify-content: space-between; }
  .content{ padding: 14px 14px 22px; }
  .topbar{
    padding: 0 12px;
  }
  .crumbs__link{
    max-width: 44vw;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (prefers-reduced-motion: reduce){
  .sidebar, .overlay{
    transition: none !important;
  }
}

/* Dashboard styles */
.dashboard-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.dashboard-grid--small{
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 32px;
}
.stat-card{
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.stat-card--compact{
  padding: 16px;
}
.stat-card__header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.stat-card__title{
  font-weight: 800;
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.stat-card__icon{
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-card__icon svg{
  width: 20px;
  height: 20px;
}
.stat-card__icon--blue{
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}
.stat-card__icon--green{
  background: rgba(22, 163, 74, 0.1);
  color: #16a34a;
}
.stat-card__icon--purple{
  background: rgba(147, 51, 234, 0.1);
  color: #9333ea;
}
.stat-card__icon--orange{
  background: rgba(249, 115, 22, 0.1);
  color: #f97316;
}
.stat-card__value{
  font-weight: 900;
  font-size: 28px;
  color: #0f172a;
  line-height: 1.2;
}
.stat-card__value--small{
  font-size: 22px;
}
.stat-card__subtitle{
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}
.dashboard-section{
  margin-top: 32px;
}
.dashboard-section__header{
  margin-bottom: 16px;
}
.dashboard-section__title{
  font-weight: 900;
  font-size: 18px;
  color: #0f172a;
  letter-spacing: -0.02em;
}
@media (max-width: 640px){
  .dashboard-grid{
    grid-template-columns: 1fr;
  }
  .stat-card__value{
    font-size: 24px;
  }
}

/* Charts */
.dashboard-charts{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}
.chart-card{
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
}
.chart-card--full{
  grid-column: 1 / -1;
}
.chart-card__header{
  margin-bottom: 16px;
}
.chart-card__title{
  font-weight: 900;
  font-size: 16px;
  color: #0f172a;
  letter-spacing: -0.02em;
}
.chart-card__body{
  position: relative;
  height: 300px;
  flex: 1;
}
.chart-card--full .chart-card__body{
  height: 400px;
}
@media (max-width: 768px){
  .dashboard-charts{
    grid-template-columns: 1fr;
  }
  .chart-card__body{
    height: 250px;
  }
  .chart-card--full .chart-card__body{
    height: 300px;
  }
}


