:root {
  --brand: #4f46e5;
  --brand-dark: #3730a3;
  --brand-light: #eef2ff;
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --radius: 14px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ---- Auth pages (login/register) ---- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: radial-gradient(circle at top left, var(--brand-light), var(--bg) 60%);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  border: 1px solid var(--border);
}
.auth-card .brand {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--brand-dark);
  margin-bottom: 1.5rem;
}
.form-control:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}
.btn-brand {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 600;
}
.btn-brand:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }

/* ---- App shell (sidebar + topbar) ---- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 250px;
  background: #0f172a;
  color: #cbd5e1;
  padding: 1.25rem 1rem;
  flex-shrink: 0;
}
.sidebar .brand { color: #fff; font-weight: 700; font-size: 1.1rem; margin-bottom: 1.5rem; display: block; }
.sidebar a {
  display: flex; align-items: center; gap: .6rem;
  color: #cbd5e1; text-decoration: none;
  padding: .6rem .75rem; border-radius: 10px; font-size: .92rem;
}
.sidebar a:hover, .sidebar a.active { background: rgba(79,70,229,0.25); color: #fff; }
.main-content { flex: 1; padding: 1.5rem; min-width: 0; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem; height: 100%;
}
.stat-card .label { color: var(--muted); font-size: .82rem; }
.stat-card .value { font-size: 1.5rem; font-weight: 700; margin-top: .25rem; }

.badge-successful { background: #dcfce7; color: var(--success); }
.badge-failed { background: #fee2e2; color: var(--danger); }
.badge-pending, .badge-processing { background: #fef3c7; color: var(--warning); }
.badge-reversed { background: #e2e8f0; color: var(--muted); }

@media (max-width: 860px) {
  .sidebar { position: fixed; left: -260px; top: 0; bottom: 0; z-index: 1040; transition: left .2s; }
  .sidebar.open { left: 0; }
  .main-content { padding: 1rem; }
}

/* ---- Notification bell ---- */
.notif-bell {
  position: fixed; top: 18px; right: 24px; z-index: 1050;
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text); box-shadow: 0 4px 12px rgba(15,23,42,.08);
}
.notif-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--danger); color: #fff; font-size: .65rem; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px;
  align-items: center; justify-content: center; padding: 0 4px;
}
.notif-panel {
  position: fixed; top: 66px; right: 24px; z-index: 1050;
  width: 320px; max-height: 420px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15,23,42,.15);
}
.notif-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 1rem; border-bottom: 1px solid var(--border); font-size: .9rem;
}
.notif-list { padding: .25rem; }
.notif-item { padding: .6rem .75rem; border-radius: 8px; cursor: pointer; }
.notif-item.unread { background: var(--brand-light); }
.notif-item:hover { background: #f1f5f9; }
.notif-title { font-weight: 600; font-size: .85rem; }
.notif-message { font-size: .8rem; color: var(--muted); }
.notif-time { font-size: .72rem; color: #94a3b8; margin-top: 2px; }

@media (max-width: 860px) {
  .notif-panel { width: calc(100vw - 32px); right: 16px; }
  .notif-bell { top: 12px; right: 16px; }
}

/* =====================================================================
   Dashboard redesign — premium fintech look
   Scoped to new dash-* / wallet-card / service-* / bottom-nav classes so
   nothing here touches existing shared layout rules above.
   ===================================================================== */
:root {
  --fintech-blue: #0057ff;
  --fintech-blue-dark: #0047d9;
  --fintech-blue-light: #eaf2ff;
}

/* ---- Header ---- */
.dash-header { display: flex; align-items: center; gap: .85rem; margin-bottom: 1.25rem; }
.dash-header__greet { flex: 1; min-width: 0; }
.dash-header__greet h4 { margin: 0; font-weight: 700; }
.dash-header__greet .sub { color: var(--muted); font-size: .85rem; }
.hamburger-btn {
  display: none;
  width: 40px; height: 40px; border-radius: 12px;
  align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); flex-shrink: 0; cursor: pointer;
}
.avatar-initials {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--fintech-blue-light); color: var(--fintech-blue-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem; flex-shrink: 0;
  text-decoration: none;
}
.dash-header__actions { display: flex; align-items: center; gap: .65rem; flex-shrink: 0; position: relative; }
.notif-bell--inline { position: static; box-shadow: 0 2px 8px rgba(15,23,42,.08); }
body.page-dashboard .notif-panel { position: absolute; top: 52px; right: 0; }
@media (max-width: 860px) {
  body.page-dashboard .notif-panel { top: 50px; right: -8px; }
}
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 1039;
}
.sidebar-overlay.open { display: block; }

/* ---- Wallet card (flip) ---- */
.wallet-flip {
  position: sticky;
  top: .75rem;
  z-index: 15;
  perspective: 1800px;
  margin-bottom: 1.75rem;
}
.wallet-flip__inner {
  position: relative;
  min-height: 225px;
}
.wallet-face {
  border-radius: 20px;
  padding: 1.05rem 1.3rem 1rem;
  color: #fff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, .28);
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transition: transform .6s cubic-bezier(.45, .15, .2, 1), opacity .45s ease;
}
/* Each face rotates on its OWN transform (not a shared parent transform) so
   the back face's content is never mathematically mirrored — it simply
   turns from 180deg (hidden) to 0deg (its natural, readable orientation).
   opacity + pointer-events are toggled in lockstep so the face that isn't
   showing can never intercept clicks meant for the visible one. */
.wallet-face--front {
  position: relative; /* front sets the wrapper's height via normal flow */
  z-index: 2;
  transform: rotateY(0deg);
  opacity: 1;
  pointer-events: auto;
  background: linear-gradient(135deg, #c81e1e 0%, #a15a1e 24%, #1f7a4d 50%, #157a83 74%, #1e3a76 100%);
}
.wallet-face--back {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  z-index: 1;
  transform: rotateY(180deg);
  opacity: 0;
  pointer-events: none;
}
/* "Sells View" back — wallet overview stats */
.wallet-face--back-overview {
  background: linear-gradient(135deg, #1e3a76 0%, #157a83 30%, #1f7a4d 56%, #a15a1e 80%, #c81e1e 100%);
}
/* "Fund Wallet" back — deliberately different palette from the overview back
   so the two flip destinations are visually distinguishable at a glance. */
.wallet-face--back-comingsoon {
  background: linear-gradient(135deg, #3b0764 0%, #6d28d9 32%, #a21caf 62%, #db2777 100%);
}
.wallet-flip.is-flipped-overview .wallet-face--front,
.wallet-flip.is-flipped-comingsoon .wallet-face--front {
  transform: rotateY(-180deg);
  opacity: 0;
  pointer-events: none;
  z-index: 1;
}
.wallet-flip.is-flipped-overview .wallet-face--back-overview {
  transform: rotateY(0deg);
  opacity: 1;
  pointer-events: auto;
  z-index: 2;
}
.wallet-flip.is-flipped-comingsoon .wallet-face--back-comingsoon {
  transform: rotateY(0deg);
  opacity: 1;
  pointer-events: auto;
  z-index: 2;
}
.wallet-face::after {
  content: "";
  position: absolute; top: -60px; right: -60px;
  width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.12), rgba(255,255,255,0) 70%);
  pointer-events: none;
}

.wallet-face__top { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; position: relative; z-index: 1; }
.wallet-face__ratebadge {
  display: inline-block;
  background: rgba(220, 38, 38, .55);
  border: 1px solid rgba(255,255,255,.25);
  color: #fff; font-weight: 700; font-size: .78rem;
  padding: .4rem .7rem; border-radius: 8px; line-height: 1.2;
}

.wallet-face__balance-row {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  font-size: 1.6rem; font-weight: 800; line-height: 1.1;
  margin: .7rem 0 .8rem;
}
#walletUsdValue { font-size: 1.05rem; font-weight: 700; opacity: .92; }
.wallet-card__eye {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: rgba(255,255,255,.18); border: none; color: #fff;
  font-size: .8rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}

.wallet-card__chip {
  width: 38px; height: 30px; border-radius: 6px; flex-shrink: 0;
  background: linear-gradient(160deg, #fff3c4 0%, #f0c454 32%, #d9a635 62%, #9c7220 100%);
  box-shadow: 0 1px 3px rgba(0,0,0,.4), inset 0 0 0 1px rgba(255,255,255,.45);
  position: relative;
}
.wallet-card__chip::before {
  content: "";
  position: absolute; top: 4px; bottom: 4px; left: 33%; width: 1px;
  background: rgba(90,60,10,.5);
  box-shadow: 12px 0 0 rgba(90,60,10,.5);
}
.wallet-card__chip::after {
  content: "";
  position: absolute; left: 4px; right: 4px; top: 33%; height: 1px;
  background: rgba(90,60,10,.5);
  box-shadow: 0 9px 0 rgba(90,60,10,.5);
}

.wallet-card__logo-ring {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  padding: 3px;
  background: conic-gradient(from 200deg, #f97316, #facc15, #34d399, #38bdf8, #6366f1, #f97316);
  display: flex; align-items: center; justify-content: center;
}
.wallet-card__logo {
  width: 100%; height: 100%; border-radius: 50%;
  background: rgba(255,255,255,.92);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .74rem; letter-spacing: .02em;
  color: var(--fintech-blue-dark);
}

.wallet-face__actions {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  margin-bottom: .85rem;
}
.btn-wallet-pill {
  display: inline-flex; align-items: center; gap: .4rem;
  border-radius: 999px; font-weight: 600; font-size: .8rem;
  padding: .42rem .9rem; border: none; cursor: pointer;
  text-decoration: none; white-space: nowrap;
}
.btn-wallet-pill--plus { background: rgba(255,255,255,.22); color: #fff; }
.btn-wallet-pill--plus:hover { background: rgba(255,255,255,.32); color: #fff; }
.btn-wallet-pill--sells { background: rgba(255,255,255,.22); color: #fff; }
.btn-wallet-pill--sells:hover { background: rgba(255,255,255,.32); color: #fff; }

.wallet-face__tel, .wallet-face__name {
  position: relative; z-index: 1;
  font-size: .88rem; letter-spacing: .04em;
}
.wallet-face__tel { margin-bottom: .25rem; opacity: .95; }
.wallet-face__name { font-weight: 700; letter-spacing: .12em; }

/* Back face */
.wallet-face__back-close {
  position: absolute; top: 1.1rem; right: 1.1rem; z-index: 2;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,.18); border: none; color: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.wallet-face__back-title {
  position: relative; z-index: 1;
  font-size: .95rem; font-weight: 700; letter-spacing: .04em;
  margin-bottom: .25rem;
}
.wallet-card__stats--back {
  flex: 1;
  display: flex; flex-direction: column; justify-content: center;
  grid-template-columns: none;
  gap: 1rem;
  margin: .75rem 0 1.1rem;
  padding-top: 0;
  border-top: none;
}
.wallet-card__stats--back .wallet-card__stat {
  display: flex; align-items: baseline; justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,.18);
  padding-bottom: .6rem;
}
.wallet-card__stats--back .wallet-card__stat + .wallet-card__stat { border-left: none; padding-left: 0; }
.wallet-card__stats--back .k { margin-bottom: 0; }

.wallet-face__coming-soon {
  position: relative; z-index: 1;
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  gap: .4rem;
}
.wallet-face__coming-soon i { font-size: 1.6rem; opacity: .85; margin-bottom: .2rem; }
.wallet-face__coming-soon-text { font-size: 1.05rem; font-weight: 700; letter-spacing: .04em; }
.wallet-face__coming-soon-sub { font-size: .78rem; opacity: .8; }

.wallet-card__stat { text-align: left; min-width: 0; }
.wallet-card__stat + .wallet-card__stat { border-left: 1px solid rgba(255,255,255,.18); padding-left: .6rem; }
.wallet-card__stat .k { font-size: .68rem; opacity: .8; margin-bottom: .2rem; white-space: nowrap; }
.wallet-card__stat .v { font-size: 1rem; font-weight: 700; }
.wallet-card__stat .v2 { font-size: .68rem; opacity: .75; margin-top: 1px; }
.wallet-card__stat--amber .v { color: #fbbf24; }
.wallet-card__stat--cyan .v { color: #22d3ee; }
.wallet-card__stat--green .v { color: #4ade80; }

.btn-wallet-primary {
  display: inline-flex; align-items: center; gap: .4rem;
  border-radius: 999px; font-weight: 600; font-size: .85rem;
  padding: .55rem 1.1rem; border: none;
  background: #fff; color: var(--fintech-blue-dark); text-decoration: none;
}
.btn-wallet-primary:hover { background: #eef4ff; color: var(--fintech-blue-dark); }

/* ---- Section headers ---- */
.section-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: .85rem; }
.section-header h6 { margin: 0; font-weight: 700; font-size: 1rem; }
.section-header a { font-size: .82rem; font-weight: 600; color: var(--fintech-blue); text-decoration: none; }
.section-header a:hover { text-decoration: underline; }

/* ---- Service icon grid ---- */
.service-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem .5rem;
  margin-bottom: 1.75rem;
}
.service-item {
  display: flex; flex-direction: column; align-items: center; gap: .45rem;
  text-align: center; text-decoration: none; color: var(--text);
  background: none; border: none; font-family: inherit;
  position: relative;
}
.service-item:hover .service-icon-circle { transform: translateY(-2px); }
.service-icon-circle {
  width: 58px; height: 58px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 6px 14px rgba(15,23,42,.08);
  border: 2px solid currentColor;
  transition: transform .15s ease;
}
.service-item .lbl { font-size: .74rem; font-weight: 600; color: var(--text); line-height: 1.15; }

.svc-green   { background: #e3f9ec; color: #16a34a; }
.svc-blue    { background: #e6f0ff; color: #0057ff; }
.svc-yellow  { background: #fff6dd; color: #d97706; }
.svc-orange  { background: #ffe9dc; color: #ea580c; }
.svc-purple  { background: #f1e9ff; color: #7c3aed; }
.svc-pink    { background: #ffe4f0; color: #db2777; }
.svc-grey    { background: #eef1f5; color: #475569; }
.svc-teal    { background: #e0f7f5; color: #0d9488; }

.more-services-group { margin-bottom: 1.25rem; }
.more-services-group .grp-label { font-size: .78rem; font-weight: 700; color: var(--muted); margin-bottom: .7rem; text-transform: uppercase; letter-spacing: .03em; }

/* ---- Promo banner ---- */
.promo-banner {
  position: relative;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: linear-gradient(120deg, var(--fintech-blue-light), #f5f9ff);
  border: 1px solid #dbe8ff;
  border-radius: 18px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.75rem;
}
.promo-banner h5 { color: var(--fintech-blue-dark); font-weight: 800; margin: 0 0 .15rem; }
.promo-banner p { margin: 0 0 .8rem; color: var(--muted); font-size: .88rem; }
.promo-banner .btn { border-radius: 999px; background: var(--fintech-blue); border-color: var(--fintech-blue); font-weight: 600; }
.promo-banner__close {
  position: absolute; top: .85rem; right: .85rem;
  width: 26px; height: 26px; border-radius: 50%;
  background: #fff; border: none; color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; box-shadow: 0 2px 6px rgba(15,23,42,.1); cursor: pointer;
}
.promo-banner__art { flex-shrink: 0; display: flex; align-items: center; justify-content: center; }

/* ---- Recent transactions ---- */
.recent-tx-item { display: flex; align-items: center; gap: .85rem; padding: .8rem 0; }
.recent-tx-item + .recent-tx-item { border-top: 1px solid var(--border); }
.recent-tx-icon {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: .95rem;
}
.recent-tx-mid { flex: 1; min-width: 0; }
.recent-tx-mid .svc { font-weight: 700; font-size: .88rem; }
.recent-tx-mid .meta { font-size: .78rem; color: var(--muted); }
.recent-tx-end { text-align: right; flex-shrink: 0; }
.recent-tx-end .amt { font-weight: 700; font-size: .88rem; }
.recent-tx-end .status { font-size: .72rem; font-weight: 700; }
.recent-tx-end .status.successful { color: var(--success); }
.recent-tx-end .status.failed { color: var(--danger); }
.recent-tx-end .status.pending, .recent-tx-end .status.processing { color: var(--warning); }
.recent-tx-end .status.reversed { color: var(--muted); }

.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty-state i { font-size: 1.8rem; color: #cbd5e1; margin-bottom: .6rem; }
.empty-state .t { font-weight: 700; color: var(--text); margin-bottom: .2rem; }
.empty-state .s { font-size: .85rem; }

/* ---- Mobile bottom navigation ---- */
.bottom-nav {
  display: none;
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 1045;
  background: #fff; border-radius: 22px;
  box-shadow: 0 14px 36px rgba(15,23,42,.18);
  padding: .55rem .5rem;
  align-items: center; justify-content: space-around;
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: .64rem; font-weight: 600;
  flex: 1;
}
.bottom-nav a i { font-size: 1.05rem; }
.bottom-nav a.active { color: var(--fintech-blue); }
.bottom-nav a.pay-cta {
  margin-top: -26px;
  width: 54px; height: 54px; border-radius: 50%;
  background: linear-gradient(135deg, var(--fintech-blue), var(--fintech-blue-dark));
  color: #fff; justify-content: center;
  box-shadow: 0 10px 22px rgba(0,87,255,.4);
  flex: 0 0 54px;
}
.bottom-nav a.pay-cta i { font-size: 1.25rem; }
.bottom-nav a.pay-cta span { display: none; }

@media (max-width: 860px) {
  .hamburger-btn { display: flex; }
  .service-grid { grid-template-columns: repeat(5, 1fr); gap: .8rem .3rem; }
  .service-icon-circle { width: 52px; height: 52px; font-size: 1.05rem; }
  .bottom-nav { display: flex; }
  .main-content { padding-bottom: 5.5rem; }
  .wallet-face__balance-row { font-size: 1.35rem; }
  .wallet-flip__inner { min-height: 210px; }
  .btn-wallet-pill { font-size: .78rem; padding: .45rem .85rem; }
  .promo-banner { padding: 1.1rem 1.1rem; gap: .5rem; }
  .promo-banner h5 { font-size: 1.05rem; }
  .promo-banner__art svg { width: 84px; height: 70px; }
}

@media (min-width: 861px) and (max-width: 1180px) {
  .service-grid { grid-template-columns: repeat(5, 1fr); }
}

@media (min-width: 1181px) {
  .service-grid { grid-template-columns: repeat(6, 1fr); }
}
