/* RemitFlow254 PoC — committed dark fintech look */
:root {
  --bg: #0C1210;
  --panel: #101815;
  --card: #16211B;
  --card-raised: #1B2822;
  --line: #263429;
  --text: #EAF1EC;
  --muted: #8FA398;
  --brand: #3DDC97;
  --brand-strong: #57E6A8;
  --brand-ink: #06130C;
  --gold: #F0B94A;
  --red: #F2716B;
  --radius: 14px;
  --z-toast: 50;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
}
[hidden] { display: none !important; }
a { color: var(--brand); }
button { font: inherit; cursor: pointer; }
input { font: inherit; }
svg.ic { width: 20px; height: 20px; stroke: currentColor; fill: currentColor; flex: none; }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* ---------- brand ---------- */
.brand-lockup { display: flex; align-items: center; gap: 0.6rem; }
.brand-name { font-weight: 700; font-size: 1.25rem; letter-spacing: -0.01em; }
.brand-lockup.small .brand-name { font-size: 1.05rem; }
.brand-254 { color: var(--brand); }
.brand-mark { display: inline-flex; }

/* ---------- auth layout ---------- */
.auth-layout {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  min-height: 100vh;
}
.auth-brand {
  padding: clamp(2rem, 6vw, 5rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.75rem;
  background:
    radial-gradient(ellipse 80% 60% at 20% 0%, rgba(61, 220, 151, 0.10), transparent 60%),
    var(--panel);
}
.auth-brand h1 {
  font-size: clamp(2.1rem, 4.5vw, 3.4rem);
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
}
.auth-sub { color: var(--muted); font-size: 1.1rem; max-width: 30rem; margin: 0; }
.trust-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 1.1rem; }
.trust-list li { display: flex; gap: 0.9rem; align-items: flex-start; }
.trust-list .ic { color: var(--brand); margin-top: 2px; fill: none; stroke: currentColor; }
.trust-list li:first-child .ic { fill: currentColor; stroke: none; }
.trust-list strong { display: block; }
.trust-list span { color: var(--muted); font-size: 0.92rem; }
.testnet-note {
  color: var(--muted);
  font-size: 0.85rem;
  border-left: 3px solid var(--gold);
  padding-left: 0.85rem;
  max-width: 28rem;
  margin: 0;
}

.auth-panel { display: flex; align-items: center; justify-content: center; padding: 2rem 1.25rem; }
.auth-card {
  width: 100%;
  max-width: 25rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.75rem;
}
.tabs { display: flex; gap: 0.4rem; background: var(--bg); border-radius: 10px; padding: 4px; margin-bottom: 1.4rem; }
.tab {
  flex: 1;
  padding: 0.55rem 0.75rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  transition: color 0.2s, background-color 0.2s;
}
.tab.active { background: var(--card-raised); color: var(--text); }
.tab:hover:not(.active) { color: var(--text); }

/* ---------- fee comparison ---------- */
.fee-section {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  background: var(--panel);
  padding: clamp(2.5rem, 6vw, 4.5rem) clamp(1.25rem, 6vw, 5rem);
}
.fee-inner { max-width: 46rem; margin: 0 auto; }
.fee-eyebrow {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 0.5rem;
}
.fee-section h2 {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 0.6rem;
  text-wrap: balance;
}
.fee-sub { color: var(--muted); max-width: 38rem; margin: 0 0 1.75rem; }

.fee-toggle { display: inline-flex; gap: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 4px; margin-bottom: 1.75rem; }
.fee-amount {
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  padding: 0.5rem 1.1rem;
  min-height: 42px;
  border-radius: 7px;
  transition: color 0.2s, background-color 0.2s;
  font-variant-numeric: tabular-nums;
}
.fee-amount:hover:not(.active) { color: var(--text); }
.fee-amount.active { background: var(--card-raised); color: var(--text); }

.fee-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.85rem; }
.fee-row {
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  gap: 0.35rem 1.25rem;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem 1.1rem;
}
.fee-row.target { border-color: rgba(61, 220, 151, 0.45); }
.fee-provider { font-weight: 600; }
.fee-provider .fee-range { display: block; font-weight: 400; font-size: 0.78rem; color: var(--muted); }
.fee-row.target .fee-provider .fee-range { color: var(--brand); }
.fee-bar-wrap { display: grid; gap: 0.3rem; min-width: 0; }
.fee-bar-track { background: var(--bg); border-radius: 999px; height: 12px; overflow: hidden; }
.fee-bar {
  height: 100%;
  border-radius: 999px;
  background: var(--red);
  transition: width 0.4s ease;
}
.fee-row.cheap .fee-bar { background: var(--gold); }
.fee-row.target .fee-bar { background: var(--brand); }
.fee-figures { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.85rem; color: var(--muted); font-variant-numeric: tabular-nums; flex-wrap: wrap; }
.fee-figures strong { color: var(--text); }
.fee-row.target .fee-figures strong { color: var(--brand); }

.fee-note { color: var(--muted); font-size: 0.8rem; max-width: 40rem; margin: 1.5rem 0 0; }

@media (max-width: 560px) {
  .fee-row { grid-template-columns: 1fr; }
}

/* ---------- forms ---------- */
.auth-form { display: grid; gap: 1rem; }
.field { display: grid; gap: 0.35rem; }
.field label { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.field .optional { font-weight: 400; }
.field input {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 0.7rem 0.85rem;
  min-height: 44px;
  transition: border-color 0.2s;
}
.field input::placeholder { color: #5A6B61; }
.field input:focus { border-color: var(--brand); outline: none; }

.btn-primary {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 700;
  border: none;
  border-radius: 10px;
  padding: 0.8rem 1.2rem;
  min-height: 48px;
  transition: background-color 0.2s;
}
.btn-primary:hover { background: var(--brand-strong); }
.btn-primary:disabled { opacity: 0.7; cursor: default; }
.btn-primary .btn-label { display: inline-flex; align-items: center; gap: 0.5rem; }
.btn-primary .ic { width: 18px; height: 18px; }
.btn-spinner {
  display: none;
  width: 18px; height: 18px;
  border: 2.5px solid rgba(6, 19, 12, 0.3);
  border-top-color: var(--brand-ink);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn-primary.loading .btn-label { visibility: hidden; }
.btn-primary.loading .btn-spinner { display: block; position: absolute; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .btn-spinner { animation-duration: 1.6s; }
  * { transition-duration: 0.01ms !important; }
}

.form-error { color: var(--red); font-size: 0.9rem; margin: 0; }
.fine { color: var(--muted); font-size: 0.8rem; text-align: center; margin: 0; }

/* ---------- app shell ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem clamp(1rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.topbar-right { display: flex; align-items: center; gap: 0.9rem; }
.net-badge {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid rgba(240, 185, 74, 0.4);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
}
.user-chip { color: var(--muted); font-size: 0.92rem; }
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 0.45rem 0.8rem;
  min-height: 40px;
  transition: border-color 0.2s, background-color 0.2s;
}
.btn-ghost:hover { border-color: var(--brand); background: var(--card); }
.btn-ghost .ic { width: 17px; height: 17px; fill: none; }

.app-main {
  display: grid;
  grid-template-columns: minmax(320px, 26rem) 1fr;
  gap: 1.5rem;
  padding: 1.75rem clamp(1rem, 4vw, 2.5rem);
  max-width: 75rem;
  margin: 0 auto;
  width: 100%;
}
.col-left { display: grid; gap: 1.5rem; align-content: start; min-width: 0; }
.col-right { min-width: 0; }
.card { min-width: 0; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem;
}
.card-title { font-size: 1.05rem; font-weight: 700; margin: 0 0 1rem; }
.card-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.4rem;
}

/* balance */
.balance-card {
  background:
    radial-gradient(ellipse 100% 90% at 100% 0%, rgba(61, 220, 151, 0.12), transparent 55%),
    var(--card);
}
.balance-amount {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  font-variant-numeric: tabular-nums;
}
.balance-amount .unit { font-size: 1.1rem; color: var(--muted); font-weight: 600; }
.balance-kes { color: var(--muted); margin: 0.15rem 0 1rem; font-variant-numeric: tabular-nums; }
.rate-note { font-size: 0.75rem; }
.wallet-row { display: flex; align-items: center; gap: 0.5rem; }
.wallet-addr {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  transition: color 0.2s, border-color 0.2s;
}
.btn-icon:hover { color: var(--brand); border-color: var(--brand); }
.btn-icon .ic { width: 17px; height: 17px; fill: none; }

/* send */
.send-card form { display: grid; gap: 1rem; }
.amount-wrap { position: relative; }
.amount-wrap input { width: 100%; padding-right: 7.5rem; }
.amount-kes {
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

/* activity */
.activity-card { min-height: 20rem; }
.activity-list { list-style: none; margin: 0; padding: 0; }
.activity-list li {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
}
.activity-list li:last-child { border-bottom: none; }
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex: none;
  background: var(--card-raised);
  color: var(--brand);
  border: 1px solid var(--line);
}
.act-body { flex: 1; min-width: 0; }
.act-who { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-meta { color: var(--muted); font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-right { text-align: right; flex: none; }
.act-amount { font-weight: 700; font-variant-numeric: tabular-nums; }
.act-amount.in { color: var(--brand); }
.act-status { font-size: 0.75rem; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
}
.chip.done { color: var(--brand); background: rgba(61, 220, 151, 0.12); }
.chip.pending { color: var(--gold); background: rgba(240, 185, 74, 0.12); }
.act-link { color: var(--muted); font-size: 0.75rem; text-decoration: none; }
.act-link:hover { color: var(--brand); }
.empty-state { color: var(--muted); text-align: center; padding: 3rem 1rem; }

.app-foot {
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  padding: 1.5rem;
}

/* toasts */
.toast-region {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  gap: 0.5rem;
  z-index: var(--z-toast);
  width: min(26rem, calc(100vw - 2rem));
}
.toast {
  background: var(--card-raised);
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  font-size: 0.92rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  animation: toast-in 0.25s ease-out;
}
.toast.warn { border-left-color: var(--gold); }
.toast.error { border-left-color: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .auth-layout { grid-template-columns: 1fr; }
  .auth-brand { padding-bottom: 1rem; }
  .app-main { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .topbar { flex-wrap: wrap; }
  .user-chip { display: none; }
  .balance-amount { font-size: 2rem; }
}
