/* Freedom Finance dashboard — dark shell inspired by ZealFlip-style layout */

:root {
  --ff-bg: #0a0a0a;
  --ff-surface: #141414;
  --ff-surface-2: #101010;
  --ff-border: rgba(255, 255, 255, 0.1);
  --ff-text: #f4f4f5;
  --ff-muted: #a1a1aa;
  --ff-dim: #71717a;
  --ff-teal: #2dd4bf;
  --ff-red: #e53935;
  --ff-coral: #ff6b6b;
  --ff-radius: 14px;
  --ff-radius-sm: 10px;
  --ff-sidebar-w: 260px;
  --ff-topbar-h: 72px;
  --font: "Inter", system-ui, -apple-system, sans-serif;
  /* Topbar */
  --ff-topbar-bg: #000000;
  --ff-search-bg: #1a1a1a;
  --ff-search-placeholder: #737373;
  /* Buttons: soft light primary (easy on eyes), muted secondary on dark */
  --ff-btn-primary-bg: #d8d8dc;
  --ff-btn-primary-fg: #18181b;
  --ff-btn-secondary-bg: rgba(255, 255, 255, 0.07);
  --ff-btn-secondary-fg: #e4e4e7;
  --ff-btn-radius: 8px;
  --ff-input-border: rgba(255, 255, 255, 0.18);
  --ff-input-focus: rgba(45, 212, 191, 0.65);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
  color-scheme: dark;
}

html:has(.ff-shell) {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  background: var(--ff-bg);
  color: var(--ff-text);
  -webkit-font-smoothing: antialiased;
}

/* Buttons: suppress default ring (inputs use explicit outlines below) */
.ff-login-page button:focus,
.ff-shell button:focus,
.ff-modal button:focus {
  outline: none;
}

/* Dashboard pages: lock viewport; main + sidebar scroll independently */
body:has(.ff-shell) {
  height: 100%;
  overflow: hidden;
}

a {
  color: var(--ff-teal);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* ========== Login (split screen) ========== */
.ff-login-page {
  min-height: 100vh;
  display: flex;
  flex-wrap: wrap;
  background: var(--ff-bg);
}

.ff-login-brand {
  flex: 1 1 320px;
  min-height: 320px;
  background: #000;
  padding: 2rem 2.5rem 5rem;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.ff-login-logo {
  display: flex;
  align-items: center;
}

.ff-login-logo-img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

.ff-login-hero {
  margin-top: auto;
  max-width: 420px;
}

.ff-login-hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 1rem;
}

.ff-login-hero p {
  color: var(--ff-muted);
  font-size: 0.95rem;
  line-height: 1.55;
  margin: 0;
}

.ff-login-ticker {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.65rem 1.5rem;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ff-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ff-login-panel {
  flex: 1 1 360px;
  min-height: 100vh;
  background: var(--ff-bg);
  color: var(--ff-text);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.ff-login-card {
  width: 100%;
  max-width: 400px;
}

.ff-login-card h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  color: #fff;
}

.ff-login-card .ff-sub {
  font-size: 0.9rem;
  color: var(--ff-muted);
  margin: 0 0 1.75rem;
  line-height: 1.45;
}

.ff-field {
  margin-bottom: 1.1rem;
}

.ff-field label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ff-dim);
  margin-bottom: 0.4rem;
}

.ff-input {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border-radius: var(--ff-radius-sm);
  border: 1px solid var(--ff-input-border);
  background: var(--ff-surface);
  font-size: 0.95rem;
  color: #fff;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.ff-input:focus {
  outline: none;
  background: #1a1a1a;
  border-color: var(--ff-input-focus);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.2);
}

.ff-input:focus-visible {
  outline: 2px solid var(--ff-input-focus);
  outline-offset: 2px;
  box-shadow: none;
}

/* Native <select> dropdowns: dark text on dark background without explicit option colors */
select.ff-input,
.ff-modal__body select {
  color-scheme: dark;
}

select.ff-input option,
.ff-modal__body select option {
  background-color: var(--ff-surface);
  color: var(--ff-text);
}

.ff-login-meta {
  display: flex;
  justify-content: flex-end;
  margin-top: -0.35rem;
  margin-bottom: 1.25rem;
}

.ff-login-meta a {
  font-size: 0.85rem;
  color: var(--ff-teal);
}

.ff-login-type {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.ff-login-type button {
  flex: 1;
  padding: 0.5rem;
  border-radius: var(--ff-btn-radius);
  border: none;
  background: var(--ff-surface);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--ff-muted);
}

.ff-login-type button.is-active {
  background: var(--ff-btn-primary-bg);
  color: var(--ff-btn-primary-fg);
}

.ff-login-footnote {
  margin-top: 1.25rem;
  font-size: 0.8rem;
  color: var(--ff-muted);
}

/* ========== App shell ========== */
.ff-shell {
  height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Full-dashboard skeleton while auth + store load */
@keyframes ff-sk-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.ff-sk-pulse {
  background: linear-gradient(
    105deg,
    var(--ff-surface) 0%,
    var(--ff-surface) 40%,
    rgba(255, 255, 255, 0.07) 50%,
    var(--ff-surface) 60%,
    var(--ff-surface) 100%
  );
  background-size: 200% 100%;
  animation: ff-sk-shimmer 1.35s ease-in-out infinite;
  border-radius: var(--ff-radius-sm);
}

@media (prefers-reduced-motion: reduce) {
  .ff-sk-pulse {
    animation: none;
    opacity: 0.72;
  }
}

.ff-dash-skeleton-overlay {
  position: absolute;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  background: var(--ff-bg);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.22s ease,
    visibility 0.22s ease;
}

.ff-shell--loading .ff-dash-skeleton-overlay {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.ff-sk-topbar {
  min-height: var(--ff-topbar-h);
  flex-shrink: 0;
  border-bottom: 1px solid var(--ff-border);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  background: var(--ff-topbar-bg);
}

.ff-sk-topbar-search {
  height: 38px;
  max-width: min(420px, 100%);
  border-radius: 999px;
  justify-self: start;
}

.ff-sk-topbar-logo {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  justify-self: center;
}

.ff-sk-topbar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  justify-self: end;
}

.ff-sk-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.ff-sk-sidebar {
  width: var(--ff-sidebar-w);
  flex-shrink: 0;
  border-right: 1px solid var(--ff-border);
  background: var(--ff-topbar-bg);
  padding: 1rem 0.75rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.ff-sk-sidebar .ff-sk-line {
  height: 10px;
  width: 5rem;
  opacity: 0.85;
}

.ff-sk-nav {
  height: 40px;
  margin: 0 0.25rem;
  border-radius: 10px;
}

.ff-sk-sidebar-foot {
  margin-top: auto;
  min-height: 88px;
  border-radius: var(--ff-radius-sm);
}

.ff-sk-main {
  flex: 1;
  min-width: 0;
  padding: 1.25rem 1.5rem 2rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ff-sk-h1 {
  height: 1.75rem;
  width: min(280px, 55%);
}

.ff-sk-sub {
  height: 0.875rem;
  width: min(420px, 85%);
  opacity: 0.9;
}

.ff-sk-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

.ff-sk-metric {
  min-height: 96px;
  border-radius: var(--ff-radius);
}

.ff-sk-card {
  min-height: 180px;
  flex: 1;
  border-radius: var(--ff-radius);
}

.ff-sk-card--short {
  min-height: 120px;
  max-width: 100%;
}

.ff-sk-main-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
  min-height: 0;
}

@media (max-width: 900px) {
  .ff-sk-topbar {
    grid-template-columns: auto 1fr auto;
  }

  .ff-sk-topbar-search {
    max-width: none;
  }

  .ff-sk-sidebar {
    display: none;
  }
}

.ff-topbar {
  min-height: var(--ff-topbar-h);
  flex-shrink: 0;
  border-bottom: 1px solid var(--ff-border);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  column-gap: 1rem;
  padding: 0 1.5rem;
  background: var(--ff-topbar-bg);
  z-index: 100;
}

.ff-topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-self: start;
  min-width: 0;
}

.ff-topbar-left .ff-search {
  flex: 1;
  min-width: 0;
  max-width: min(420px, 100%);
}

.ff-topbar-center {
  justify-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.ff-topbar-right {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ff-topbar-logo-img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

.ff-sidebar-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.ff-sidebar-toggle svg {
  width: 22px;
  height: 22px;
  opacity: 0.9;
}

.ff-search {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: var(--ff-search-bg);
  border: none;
  border-radius: 999px;
  padding: 0.45rem 0.85rem 0.45rem 0.95rem;
}

.ff-search-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ff-dim);
  flex-shrink: 0;
  opacity: 0.95;
}

.ff-search-ico svg {
  width: 15px;
  height: 15px;
}

.ff-search input {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 400;
  min-width: 0;
  border-radius: 6px;
}

.ff-search input:focus {
  outline: none;
}

.ff-search input:focus-visible {
  outline: 2px solid var(--ff-input-focus);
  outline-offset: 2px;
}

.ff-search input::placeholder {
  color: var(--ff-search-placeholder);
}

.ff-search kbd {
  font-family: inherit;
  font-size: 0.62rem;
  font-weight: 500;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ff-muted);
  flex-shrink: 0;
}

.ff-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ff-search-bg);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ff-teal);
}

.ff-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.ff-sidebar {
  width: var(--ff-sidebar-w);
  flex-shrink: 0;
  background: var(--ff-topbar-bg);
  border-right: 1px solid var(--ff-border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  transition: transform 0.25s ease;
}

/* Scrollable nav only — profile stays pinned at bottom */
.ff-sidebar-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem 0 0.5rem;
}

.ff-nav-section {
  padding: 0.5rem 0.75rem;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ff-dim);
}

.ff-nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 1rem;
  margin: 0 0.5rem;
  border-radius: 10px;
  color: var(--ff-muted);
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  text-decoration: none;
}

.ff-nav-label {
  flex: 1;
  min-width: 0;
}

.ff-nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
  text-decoration: none;
}

.ff-nav-link.is-active {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.ff-nav-link.is-active::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  flex-shrink: 0;
}

.ff-nav-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: inherit;
  opacity: 0.9;
}

.ff-nav-ico svg {
  width: 20px;
  height: 20px;
}

.ff-sidebar-profile {
  flex-shrink: 0;
  margin: 0.5rem 0.75rem 0.75rem;
  padding: 0.85rem 1rem;
  font-size: 0.75rem;
  color: var(--ff-dim);
  background: var(--ff-surface);
  border: 1px solid var(--ff-border);
  border-radius: var(--ff-radius-sm);
}

.ff-sidebar-profile strong {
  display: block;
  color: var(--ff-muted);
  font-size: 0.8rem;
  margin-bottom: 0.2rem;
  word-break: break-all;
}

.ff-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  padding: 1.25rem 1.5rem 2rem;
  overflow-x: hidden;
  overflow-y: auto;
}

.ff-page-head {
  margin-bottom: 1.5rem;
}

.ff-page-head h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
}

.ff-page-head p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--ff-muted);
  max-width: 640px;
  line-height: 1.45;
}

.ff-page-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.ff-page-head-row > div:first-child {
  min-width: 0;
  flex: 1 1 240px;
}

.ff-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* Balance & withdrawals: four summary cards share the row evenly */
#wallet-metrics.ff-metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* Dashboard: seven metric tiles — four per row, then remainder */
#user-metrics.ff-metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media screen and (max-width: 1024px) {
  #wallet-metrics.ff-metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #user-metrics.ff-metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.ff-metric {
  --ff-metric-icon-slot: calc(36px + 0.625rem);
  background: var(--ff-surface);
  border: none;
  border-radius: var(--ff-radius);
  padding: 1.1rem 1.15rem;
  position: relative;
  overflow: hidden;
  min-width: 0;
}

/* Keep label, value, and hint out from under the absolutely positioned corner icon */
.ff-metric > :not(.ff-metric-ico) {
  padding-right: var(--ff-metric-icon-slot);
  max-width: 100%;
  box-sizing: border-box;
}

.ff-metric-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ff-dim);
}

.ff-metric-value {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0.35rem 0 0.2rem;
  letter-spacing: -0.02em;
}

/* Currency amounts on metric cards: shrink via JS if overflow; tabular figures for alignment */
.ff-metric-value--money {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.ff-table td.ff-money,
.ff-table th.ff-money {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  white-space: nowrap;
  text-align: right;
}

.ff-metric-hint {
  font-size: 0.75rem;
  color: var(--ff-muted);
}

.ff-metric-cta {
  margin-top: 0.65rem;
}

.ff-metric-cta .ff-btn {
  text-transform: none;
  letter-spacing: normal;
}

.ff-metric-ico {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 1;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ff-metric-ico svg,
.ff-svg-ico {
  display: block;
}

.ff-metric-ico svg {
  width: 18px;
  height: 18px;
}

.ff-metric-ico--g {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}
.ff-metric-ico--t {
  background: rgba(45, 212, 191, 0.15);
  color: var(--ff-teal);
}
.ff-metric-ico--b {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}
.ff-metric-ico--r {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}
.ff-metric-ico--p {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
}
.ff-metric-ico--y {
  background: rgba(234, 179, 8, 0.15);
  color: #facc15;
}

.ff-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
  background: var(--ff-surface-2);
  padding: 0.25rem;
  border-radius: 10px;
  width: fit-content;
  max-width: 100%;
  flex-wrap: wrap;
}

.ff-tab {
  padding: 0.45rem 1rem;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--ff-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.ff-tab.is-active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.ff-card {
  background: var(--ff-surface);
  border: none;
  border-radius: var(--ff-radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.ff-card h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.ff-card .ff-sub {
  font-size: 0.8rem;
  color: var(--ff-muted);
  margin: 0 0 1rem;
}

.ff-profile-card-title {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
}

.ff-profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.ff-profile-grid-span-2 {
  grid-column: 1 / -1;
}

@media screen and (max-width: 560px) {
  .ff-profile-grid {
    grid-template-columns: 1fr;
  }

  .ff-profile-grid-span-2 {
    grid-column: auto;
  }
}

.ff-calc-result {
  margin: 0.25rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.ff-calc-result strong {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ff-dim);
}

.ff-calc-result span {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ff-teal);
  font-variant-numeric: tabular-nums;
}

/* Crypto deposit cards (borrower repayments) */
.ff-crypto-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 1rem;
  width: 100%;
}

.ff-crypto-card {
  border: 1px solid var(--ff-border);
  border-radius: var(--ff-radius);
  overflow: hidden;
  background: var(--ff-surface);
  align-self: start;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}

.ff-crypto-card__toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.25rem;
  padding: 1rem 1.25rem;
  margin: 0;
  background: rgba(255, 255, 255, 0.04);
  border: none;
  color: var(--ff-text);
  font: inherit;
  font-weight: 600;
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}

.ff-crypto-card__toggle:hover {
  background: rgba(255, 255, 255, 0.08);
}

.ff-crypto-card__toggle:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--ff-input-focus);
}

.ff-crypto-card__title {
  min-width: 0;
  flex: 1;
  line-height: 1.35;
}

.ff-crypto-card__chev {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ff-muted);
  transition: transform 0.2s ease;
}

.ff-crypto-card__chev svg {
  width: 22px;
  height: 22px;
}

.ff-crypto-card.is-open .ff-crypto-card__chev {
  transform: rotate(180deg);
}

.ff-crypto-card__panel {
  padding: 0 1.25rem 1.25rem;
  border-top: 1px solid var(--ff-border);
}

.ff-crypto-card__panel[hidden] {
  display: none !important;
}

.ff-crypto-qr-frame {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 1.1rem;
  padding: 1.25rem 1.5rem;
  background: #ffffff;
  border-radius: 18px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.ff-crypto-qr-canvas {
  display: block;
  width: 100%;
  max-width: 240px;
  height: auto;
  border-radius: 14px;
  vertical-align: top;
}

.ff-crypto-addr-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 1.1rem;
}

.ff-crypto-addr {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8125rem;
  line-height: 1.5;
  word-break: break-all;
  color: var(--ff-text);
  padding: 0.75rem 1rem;
  background: var(--ff-surface-2);
  border-radius: var(--ff-radius-sm);
  border: 1px solid var(--ff-border);
}

.ff-crypto-copy {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 0.9rem;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
}

.ff-crypto-copy__ico {
  display: flex;
  align-items: center;
  justify-content: center;
}

.ff-crypto-copy__ico .ff-svg-ico,
.ff-crypto-copy .ff-svg-ico {
  width: 18px;
  height: 18px;
}

.ff-crypto-copy__txt {
  display: inline;
}

@media screen and (max-width: 480px) {
  .ff-crypto-copy__txt {
    display: none;
  }

  .ff-crypto-copy {
    padding: 0.6rem;
    min-width: 2.75rem;
  }
}

.ff-chart-wrap {
  position: relative;
  height: 220px;
}

.ff-table-wrap {
  overflow-x: auto;
}

table.ff-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.ff-table th,
.ff-table td {
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-bottom: none;
}

.ff-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.ff-table td.ff-row-actions {
  position: relative;
  z-index: 1;
}

.ff-table td.ff-row-actions .ff-btn {
  position: relative;
  z-index: 2;
}

/* User withdrawal table: Details / Cancel row buttons */
.ff-wd-btn.ff-btn--sm {
  min-width: 4.75rem;
}

.ff-table th {
  color: var(--ff-dim);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.05em;
}

.ff-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ff-badge--pending {
  background: rgba(234, 179, 8, 0.2);
  color: #fbbf24;
}
.ff-badge--review {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}
.ff-badge--approved {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
}
.ff-badge--funded {
  background: rgba(45, 212, 191, 0.2);
  color: var(--ff-teal);
}
.ff-badge--denied {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.ff-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--ff-btn-radius);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  border: none;
  background: transparent;
  color: #fff;
  text-decoration: none;
  transition: background 0.2s, opacity 0.2s, color 0.2s;
}

.ff-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  text-decoration: none;
}

.ff-btn--primary {
  background: var(--ff-btn-primary-bg);
  color: var(--ff-btn-primary-fg);
}

.ff-btn--primary:hover {
  background: #cacace;
  color: var(--ff-btn-primary-fg);
}

.ff-btn--primary:active {
  background: #bcbcc2;
}

.ff-btn--secondary {
  background: var(--ff-btn-secondary-bg);
  color: var(--ff-btn-secondary-fg);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.ff-btn--secondary:hover {
  background: rgba(255, 255, 255, 0.11);
  color: #f4f4f5;
}

.ff-btn--danger {
  border: none;
  color: #f87171;
  background: rgba(239, 68, 68, 0.12);
}

.ff-btn--danger:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.ff-btn--ghost {
  background: transparent;
  color: var(--ff-muted);
}

.ff-btn--ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.ff-btn--sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.65rem;
}

.ff-btn--loading {
  pointer-events: none;
  opacity: 0.75;
}

.ff-btn--loading::after {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: ff-spin 0.7s linear infinite;
}

.ff-btn--primary.ff-btn--loading::after {
  border-color: rgba(24, 24, 27, 0.2);
  border-top-color: #18181b;
}

.ff-btn--secondary.ff-btn--loading::after {
  border-color: rgba(255, 255, 255, 0.2);
  border-top-color: #f4f4f5;
}

@keyframes ff-spin {
  to {
    transform: rotate(360deg);
  }
}

.ff-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

/* Toasts — top right */
.ff-toast-stack {
  position: fixed;
  top: 1rem;
  right: 1rem;
  left: auto;
  z-index: 20000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: min(360px, calc(100vw - 2rem));
  pointer-events: none;
}

.ff-toast {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  background: var(--ff-surface);
  border: none;
  color: #fff;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transform: translateX(14px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: auto;
  width: 100%;
  box-sizing: border-box;
}

.ff-toast--show {
  opacity: 1;
  transform: translateX(0);
}

.ff-toast--success {
  border: none;
}
.ff-toast--error {
  border: none;
  color: #fecaca;
}
.ff-toast--info {
  border: none;
}

/* Modal */
.ff-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 15000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: ff-fade-in 0.2s ease;
}

.ff-modal-backdrop--out {
  opacity: 0;
  transition: opacity 0.2s;
}

@keyframes ff-fade-in {
  from {
    opacity: 0;
  }
}

.ff-modal {
  background: var(--ff-surface);
  border: none;
  border-radius: var(--ff-radius);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.65);
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  padding: 1.25rem 1.35rem;
  animation: ff-modal-up 0.25s ease;
}

.ff-modal--wizard {
  max-width: 520px;
}

.ff-wizard-ind {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.75rem;
}

.ff-wizard-ind__step {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ff-dim);
  padding: 0.3rem 0.55rem;
  border-radius: 6px;
}

.ff-wizard-ind__step.is-active {
  color: var(--ff-teal);
  background: rgba(45, 212, 191, 0.12);
}

.ff-wizard-ind__step.is-done {
  color: var(--ff-muted);
}

.ff-modal__body--wizard {
  min-height: 5rem;
}

.ff-review-block {
  margin-top: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--ff-surface-2);
  border-radius: var(--ff-radius-sm);
  border: 1px solid var(--ff-border);
  font-size: 0.85rem;
  color: var(--ff-text);
}

.ff-review-block strong {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ff-dim);
}

.ff-review-block p {
  margin: 0.4rem 0 0;
  color: var(--ff-muted);
  line-height: 1.45;
}

.ff-proof-img {
  max-width: 100%;
  height: auto;
  border-radius: var(--ff-radius-sm);
  display: block;
  margin-top: 0.5rem;
  border: 1px solid var(--ff-border);
}

@keyframes ff-modal-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

/* Withdrawal detail modal: labeled rows instead of raw JSON */
.ff-withdrawal-summary {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-height: min(60vh, 28rem);
  overflow: auto;
  padding-right: 0.25rem;
}

.ff-withdrawal-summary__title {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ff-muted);
}

.ff-withdrawal-summary__dl {
  display: grid;
  grid-template-columns: minmax(7rem, 38%) 1fr;
  gap: 0.35rem 1rem;
  margin: 0;
  font-size: 0.9rem;
}

.ff-withdrawal-summary__dl dt {
  margin: 0;
  color: var(--ff-muted);
  font-weight: 500;
}

.ff-withdrawal-summary__dl dd {
  margin: 0;
  word-break: break-word;
  color: var(--ff-text);
}

.ff-modal-hint {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: var(--ff-muted);
}

.ff-modal__title {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

.ff-modal__body {
  font-size: 0.875rem;
  color: var(--ff-muted);
  line-height: 1.5;
  margin-bottom: 1rem;
}

.ff-modal__body .ff-field {
  margin-bottom: 0.85rem;
}

.ff-modal__body label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ff-dim);
  margin-bottom: 0.25rem;
}

.ff-modal__body input,
.ff-modal__body select,
.ff-modal__body textarea {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--ff-input-border);
  background: var(--ff-surface-2);
  color: #fff;
  font-size: 0.85rem;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.ff-modal__body input:focus,
.ff-modal__body select:focus,
.ff-modal__body textarea:focus {
  outline: none;
  border-color: var(--ff-input-focus);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.2);
}

.ff-modal__body input:focus-visible,
.ff-modal__body select:focus-visible,
.ff-modal__body textarea:focus-visible {
  outline: 2px solid var(--ff-input-focus);
  outline-offset: 2px;
  box-shadow: none;
}

.ff-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Mobile sidebar */
/* Hide scrollbars where regions scroll independently */
.ff-sidebar-scroll,
.ff-main,
.ff-modal,
.ff-table-wrap {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.ff-sidebar-scroll::-webkit-scrollbar,
.ff-main::-webkit-scrollbar,
.ff-modal::-webkit-scrollbar,
.ff-table-wrap::-webkit-scrollbar {
  width: 0;
  height: 0;
}

@media screen and (max-width: 991px) {
  .ff-topbar {
    grid-template-columns: auto 1fr auto;
  }

  .ff-topbar-left .ff-search {
    display: none;
  }

  .ff-sidebar-toggle {
    display: flex;
  }

  .ff-sidebar {
    position: fixed;
    left: 0;
    top: var(--ff-topbar-h);
    bottom: 0;
    z-index: 90;
    width: min(var(--ff-sidebar-w), 88vw);
    transform: translateX(-100%);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.4);
    height: auto;
  }

  .ff-layout.is-nav-open .ff-sidebar {
    transform: translateX(0);
  }

  .ff-layout::after {
    content: "";
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 80;
  }

  .ff-layout.is-nav-open::after {
    display: block;
  }
}

@media screen and (max-width: 640px) {
  .ff-login-panel {
    min-height: auto;
  }

  .ff-metric-grid {
    grid-template-columns: 1fr;
  }

  #wallet-metrics.ff-metric-grid {
    grid-template-columns: 1fr;
  }

  #user-metrics.ff-metric-grid {
    grid-template-columns: 1fr;
  }
}

/* Table pagination (admin + user dashboards) */
.ff-table-pager {
  margin-top: 0.75rem;
  min-height: 2.25rem;
}

.ff-table-pager-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

.ff-table-pager-meta {
  font-size: 0.8125rem;
  color: var(--ff-muted);
}
