:root {
  --bg: #050b18;
  --bg-grad-1: #0b1e44;
  --bg-grad-2: #0b5cfb;
  --card: rgba(18, 39, 86, 0.65);
  --card-strong: rgba(22, 52, 112, 0.9);
  --accent: #5cc4ff;
  --accent-2: #3f8cff;
  --text: #eaf4ff;
  --muted: #a8b9d8;
  --border: rgba(255, 255, 255, 0.08);
  --radius: 18px;
  --shadow: 0 18px 48px rgba(5, 12, 40, 0.45);
  --font-main: 'IBM Plex Sans', 'Space Grotesk', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font-main);
  background: radial-gradient(circle at 16% 18%, rgba(92, 196, 255, 0.14), transparent 40%),
              radial-gradient(circle at 82% 12%, rgba(63, 140, 255, 0.18), transparent 44%),
              linear-gradient(160deg, var(--bg) 0%, var(--bg-grad-1) 38%, var(--bg-grad-2) 110%);
  color: var(--text);
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(transparent 95%, rgba(255,255,255,0.02) 95%),
                    linear-gradient(90deg, transparent 95%, rgba(255,255,255,0.02) 95%);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

.container {
  width: min(1200px, 92vw);
  margin: 96px auto 64px;
  position: relative;
  z-index: 1;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: rgba(9, 18, 42, 0.82);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar a, .topbar span {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.logo {
  font-weight: 700;
  letter-spacing: 0.6px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.logo::before {
  content: "";
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 24px rgba(63, 140, 255, 0.35);
}

.nav-toggle-btn {
  display: none;
  color: var(--text);
  font-size: 24px;
  padding: 8px;
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  margin-left: auto;
}

#nav-toggle { display: none; }

.btn, button {
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  color: #041026;
  border: none;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.1s ease, box-shadow 0.2s;
}

.btn:hover, button:hover { transform: translateY(-1px); box-shadow: 0 14px 40px rgba(0,0,0,0.35); }

.btn.ghost, button.ghost { background: transparent; color: var(--text); border: 1px solid rgba(255,255,255,0.14); box-shadow: none; }

.btn.full, button.full { width: 100%; }

.inline-form { display: inline; }

.flash { margin-bottom: 12px; padding: 12px 14px; border-radius: 10px; background: var(--card); border: 1px solid var(--border); }
.flash.success { border-color: #2dd4bf; }
.flash.error { border-color: #f97316; }
.error-text { color: #fda4af; font-size: 13px; display: block; margin-top: 4px; }
.field input, .field select, .field textarea { width: 100%; margin-top: 6px; }
.field input, .field select, .field textarea {
  background: rgba(10,20,46,0.9);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text);
  padding: 12px;
  border-radius: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(92,196,255,0.25);
}
.admin-card {
  border: 1px solid rgba(255,255,255,0.12);
  background: linear-gradient(160deg, rgba(12,24,52,0.9), rgba(18,39,86,0.8));
}
.admin-card h3 { margin-top: 0; }
.admin-card .btn.ghost { border-color: rgba(255,255,255,0.18); }

.hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; align-items: center; }
.eyebrow { text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-size: 12px; }
.currency { color: var(--accent); font-size: 20px; }

.glass {
  background: linear-gradient(150deg, rgba(92, 196, 255, 0.14), rgba(10, 30, 60, 0.6));
  border: 1px solid rgba(92, 196, 255, 0.25);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card {
  background: var(--card);
  backdrop-filter: blur(10px);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-top: 24px; }

/* Trade page responsive layout */
.trade-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
  align-items: start;
}

.trade-form input,
.trade-form select {
  width: 100%;
  background: linear-gradient(180deg, rgba(16,32,64,0.9), rgba(8,16,36,0.95));
  border: 1px solid rgba(92,196,255,0.18);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 15px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 8px 28px rgba(6,12,30,0.35);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.trade-form input:focus,
.trade-form select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(92,196,255,0.22);
  transform: translateY(-1px);
}
.trade-form input::placeholder {
  color: rgba(232,242,255,0.7);
}
.trade-form .mini-label {
  font-size: 12px;
  letter-spacing: 0.4px;
  color: var(--muted);
  text-transform: uppercase;
}

@media (max-width: 960px) {
  .trade-layout { grid-template-columns: 1fr; }
  .trade-layout iframe { height: 320px !important; }
  .topbar { padding: 0 18px; }
  .container { width: 94vw; margin-top: 84px; }
}

@media (max-width: 640px) {
  .hero { grid-template-columns: 1fr; }
  .tx-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .card { padding: 16px; }
  .trade-layout iframe { height: 360px !important; }
}
.wallet-card {
  background: linear-gradient(180deg, rgba(63,140,255,0.2), rgba(18,39,86,0.8));
  border: 1px solid rgba(92,196,255,0.25);
  position: relative;
  overflow: hidden;
}

.wallet-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% -10%, rgba(255,255,255,0.08), transparent 40%);
  pointer-events: none;
}

.wallet-card .card-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.wallet-card .card-head > div:first-child { min-width: 0; }
.wallet-card h2 { font-size: clamp(22px, 4vw, 28px); margin: 6px 0; }
.wallet-card p { margin: 4px 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; }
.icon-btn { color: var(--text); text-decoration: none; font-size: 22px; display: inline-flex; align-items: center; background: rgba(255,255,255,0.06); border-radius: 12px; padding: 8px; }

.muted { color: var(--muted); }
.mono { font-family: 'Space Grotesk', 'SFMono-Regular', Consolas, monospace; word-break: break-word; overflow-wrap: anywhere; }
.copyable { overflow-wrap: anywhere; word-break: break-word; max-width: 100%; display: inline-block; }

.create-wallet input, .action-card input, .action-card textarea, .auth-card input, .auth-card textarea, .auth-card select {
  width: 100%; padding: 12px 12px; border-radius: 14px; border: 1px solid rgba(255,255,255,0.08); background: rgba(10, 20, 46, 0.8); color: var(--text); margin: 8px 0 12px;
}

.wallet-selector {
  display: grid;
  gap: 8px;
}
.wallet-selector.two-col { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.wallet-selector .choice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(12, 24, 52, 0.7);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}
.wallet-selector .choice:hover { border-color: var(--accent); transform: translateY(-1px); }
.wallet-selector .choice input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}
.wallet-selector .choice .label-body { display: flex; flex-direction: column; gap: 4px; }
.wallet-selector .ticker { font-weight: 700; color: var(--accent); line-height: 1.1; }
.wallet-selector .muted { color: var(--muted); }
.accordion summary {
  cursor: pointer;
  padding: 10px 0;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
}
.accordion summary::marker { content: ""; }
.accordion[open] summary::after { content: "▾"; font-size: 12px; }
.accordion summary::after { content: "▸"; font-size: 12px; }
.accordion {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px 12px;
  background: rgba(12,24,52,0.5);
}
.accordion .wallet-selector { margin-top: 4px; }

.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.action-card h3 { margin-top: 0; }

.tx-list { display: flex; flex-direction: column; gap: 12px; }
.tx-row { display: grid; grid-template-columns: 90px 1fr 160px; align-items: center; gap: 12px; }
.tx-list .tx-row + .tx-row {
  border-top: 1px dashed var(--border);
  padding-top: 8px;
  margin-top: 4px;
}
.tx-card { display: flex; flex-direction: column; gap: 10px; }
.tx-card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.tx-card__left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tx-card__meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }
.tx-card__body { display: grid; gap: 8px; }
.tx-line { display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
.tx-line .label { color: var(--muted); font-size: 12px; letter-spacing: 0.5px; text-transform: uppercase; font-weight: 700; }
.tx-line .value { min-width: 0; }
.tx-line .icon-btn { padding: 6px; font-size: 18px; }
.tx-amount { font-size: 20px; font-weight: 700; text-align: right; }
.tx-time { color: var(--muted); }
.tx-line .addr, .tx-line .hash { word-break: break-all; overflow-wrap: anywhere; }
.tx-filter { display: grid; grid-template-columns: 1fr 1fr 110px; gap: 10px; align-items: end; }
.hash-input {
  width: 100%;
  background: linear-gradient(135deg, rgba(12,24,52,0.9), rgba(18,39,86,0.9));
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  box-shadow: 0 8px 24px rgba(0,0,0,0.24);
}
.freeze-banner {
  border: 1px solid rgba(255,149,128,0.4);
  background: rgba(255,149,128,0.1);
}
.badge { padding: 6px 10px; border-radius: 999px; font-weight: 600; width: fit-content; }
.badge.in { background: rgba(92, 196, 255, 0.16); color: #7ad8ff; }
.badge.out { background: rgba(255, 149, 128, 0.18); color: #ffb199; }
.amount { text-align: right; font-weight: 600; }
.badge.status { padding: 8px 12px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.badge.status.not_verified { background: rgba(255,255,255,0.06); color: #fca5a5; border: 1px solid rgba(252,165,165,0.5); }
.badge.status.pending { background: rgba(255, 204, 102, 0.12); color: #facc15; border: 1px solid rgba(250,204,21,0.4); }
.badge.status.verified { background: rgba(92, 196, 255, 0.16); color: #7ad8ff; border: 1px solid rgba(92,196,255,0.5); }

.mini-label { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-bottom: 8px; }

.file-upload .upload-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px dashed rgba(255,255,255,0.25);
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  position: relative;
  cursor: pointer;
}
.file-upload i { font-size: 20px; color: var(--accent); }
.file-upload input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.file-upload .muted { margin: 0; }
.doc-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.pill-switch {
  display: inline-flex;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
  gap: 6px;
}
.pill-switch label {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
  transition: all 0.2s ease;
}
.pill-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.pill-switch label.active,
.pill-switch input:checked + span {
  color: var(--text);
}
.pill-switch label.active {
  background: linear-gradient(120deg, rgba(92,196,255,0.16), rgba(63,140,255,0.24));
  border: 1px solid rgba(92,196,255,0.4);
}
.pill-switch span { pointer-events: none; }

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s ease;
}
.pill-btn.active {
  background: linear-gradient(120deg, rgba(92,196,255,0.16), rgba(63,140,255,0.24));
  border-color: rgba(92,196,255,0.4);
}

.copy-btn.copied { color: var(--accent); }

.status-pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.status-pill.pending { background: rgba(250,204,21,0.14); color: #facc15; border: 1px solid rgba(250,204,21,0.45); }
.status-pill.confirmed { background: rgba(92,196,255,0.16); color: #7ad8ff; border: 1px solid rgba(92,196,255,0.5); }
.status-pill.frozen { background: rgba(255,149,128,0.18); color: #ffb199; border: 1px solid rgba(255,149,128,0.4); }

.from-highlight { color: #7ad8ff; font-weight: 600; }

.auth-card { max-width: 420px; margin: 0 auto; }
.auth-card h1 { margin-top: 0; }
.auth-card label { display: block; font-weight: 600; margin-top: 12px; }
.auth-card input { margin-top: 6px; }

/* Chat widget */
.chat-fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 60px;
  height: 60px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.18);
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  color: #041026;
  box-shadow: 0 16px 42px rgba(0,0,0,0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  z-index: 50;
  cursor: pointer;
}
.chat-fab__dot {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 10px;
  height: 10px;
  background: #f97316;
  border-radius: 999px;
  box-shadow: 0 0 0 6px rgba(249, 115, 22, 0.15);
}
.chat-panel {
  position: fixed;
  right: 18px;
  bottom: 90px;
  width: min(360px, 92vw);
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(12,22,44,0.96), rgba(10,18,38,0.94));
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  z-index: 50;
  backdrop-filter: blur(14px);
}
.chat-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 4px 2px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.chat-panel__body {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
  padding-top: 4px;
}
.chat-msg {
  padding: 10px 12px;
  border-radius: 14px;
  max-width: 90%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 10px 26px rgba(0,0,0,0.25);
}
.chat-msg.me {
  margin-left: auto;
  background: linear-gradient(140deg, rgba(92,196,255,0.16), rgba(63,140,255,0.28));
  border-color: rgba(92,196,255,0.45);
}
.chat-msg.them { margin-right: auto; }
.chat-msg.deleted { opacity: 0.6; font-style: italic; }
.chat-msg__meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.chat-msg__text { white-space: pre-wrap; line-height: 1.45; word-break: break-word; overflow-wrap: anywhere; }
.chat-panel__form {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}
.chat-panel__form textarea {
  width: 100%;
  background: rgba(10,20,46,0.9);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 10px 12px;
  resize: vertical;
}
.chat-panel__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.chat-panel__body::-webkit-scrollbar { width: 6px; }
.chat-panel__body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.18); border-radius: 999px; }

/* Chat page / admin */
.chat-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
}
.chat-users {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-user-card {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(12,24,52,0.7);
  text-decoration: none;
  color: var(--text);
  display: block;
}
.chat-user-card .top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.dot-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f97316;
  color: #0a162f;
  font-weight: 700;
  font-size: 11px;
  box-shadow: 0 0 0 6px rgba(249,115,22,0.12);
  letter-spacing: 0.4px;
}
.chat-user-card.active { border-color: rgba(92,196,255,0.5); background: rgba(92,196,255,0.08); }
.chat-thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chat-thread.scrollable {
  max-height: 70vh;
  overflow-y: auto;
  padding-right: 6px;
}
.chat-thread .chat-msg { max-width: 100%; }

/* Admin portal: clients */
.client-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 72vh;
  overflow-y: auto;
  padding-right: 6px;
}
.client-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(12,24,52,0.75);
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, transform 0.1s;
}
.client-card:hover { border-color: rgba(92,196,255,0.5); transform: translateY(-1px); }
.client-card.active { border-color: rgba(92,196,255,0.8); box-shadow: 0 12px 28px rgba(0,0,0,0.35); }
.client-card .top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.client-card .name { font-weight: 700; font-size: 14px; }
.client-card .meta { color: var(--muted); font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }
.client-card .pill { padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,0.06); border: 1px solid var(--border); font-weight: 600; }
.client-card .dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #f97316;
  box-shadow: 0 0 0 6px rgba(249, 115, 22, 0.2);
  margin-left: 8px;
}
.chat-nav-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #f97316;
  box-shadow: 0 0 0 6px rgba(249,115,22,0.2);
  display: inline-block;
}
.chat-edit-area {
  width: 100%;
  min-height: 96px;
  background: rgba(10,20,46,0.9);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 12px;
  padding: 10px 12px;
  resize: both;
  min-width: 280px;
  max-width: 100vw;
  font: inherit;
}
.chat-edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.chat-send-box {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr;
}
.chat-textarea {
  width: 100%;
  background: rgba(10,20,46,0.9);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 10px 12px;
  resize: vertical;
}
.chat-file {
  color: var(--muted);
}
.input-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.input-stack select,
.input-stack input[type=\"number\"],
.input-stack input[type=\"text\"],
.input-stack input[type=\"decimal\"],
.input-stack textarea {
  width: 100%;
  background: rgba(10,20,46,0.9);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
}
.input-stack input.amount {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.2px;
  padding: 10px 12px;
}
.input-stack input:disabled,
.input-stack select:disabled {
  opacity: 0.85;
  background: rgba(10,20,46,0.7);
  color: var(--text);
  border-color: rgba(255,255,255,0.18);
}
.input-stack .readonly {
  pointer-events: none;
}
.error { color: #fca5a5; font-size: 12px; }
.table.like-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.table.like-list .row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
}
.table.like-list .row.head {
  font-weight: 700;
  background: rgba(255,255,255,0.06);
}

.earn-form {
  max-width: 520px;
  width: 100%;
}

@media (max-width: 720px) {
  .earn-form {
    max-width: 100%;
  }
  .table.stack-mobile .row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .table.stack-mobile .row.head { display: none; }
  .table.stack-mobile .row > div {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 14px;
  }
  .table.stack-mobile .row > div::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 600;
  }
}

@media (max-width: 720px) {
  .topbar {
    padding: 0 14px;
    background: rgba(7, 15, 34, 0.98);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(92, 196, 255, 0.14);
  }
  .container { margin-top: 88px; }
  .tx-row { grid-template-columns: 1fr; align-items: flex-start; }
  .nav-toggle-btn { display: inline-flex; }
  .topbar nav {
    position: fixed;
    top: 68px;
    right: 12px;
    left: 12px;
    background: linear-gradient(180deg, rgba(10, 20, 44, 0.995), rgba(6, 13, 30, 0.995));
    border: 1px solid rgba(92, 196, 255, 0.14);
    border-radius: 16px;
    padding: 14px;
    display: none;
    flex-direction: column;
    gap: 12px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
    z-index: 15;
  }
  #nav-toggle:checked ~ nav { display: flex; }
  .topbar nav a,
  .topbar nav .user-chip,
  .topbar nav .ghost {
    width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
  }
  .topbar nav a,
  .topbar nav .user-chip {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
  }
  .topbar nav form { width: 100%; }
  .topbar nav button { width: 100%; }
  .tx-card { gap: 8px; }
  .tx-card__head { align-items: flex-start; }
  .tx-amount { text-align: left; width: 100%; }
  .tx-card__meta { width: 100%; justify-content: space-between; }
  .tx-filter { grid-template-columns: 1fr; }
  .chat-layout { grid-template-columns: 1fr; }
  .chat-panel { right: 12px; left: 12px; width: auto; }
}

/* Narrow phones and older 320-400px devices */
@media (max-width: 540px) {
  .container { width: 94vw; margin: 82px auto 48px; }
  .topbar { height: 64px; padding: 0 14px; }
  .topbar nav { gap: 10px; }
  .btn, button { padding: 12px 14px; font-size: 14px; }
  .card, .auth-card, .create-wallet input, .action-card input, .action-card textarea { border-radius: 14px; }
  .hero { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
  .tx-filter { grid-template-columns: 1fr; }
  .actions { grid-template-columns: 1fr; }
  .wallet-card .card-head { gap: 10px; }
  .tx-card__meta { gap: 8px; }
  .chat-panel {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    max-height: 76vh;
    border-radius: 18px 18px 0 0;
    padding: 16px;
  }
  .chat-fab { right: 14px; bottom: 14px; }
}

@media (max-width: 400px) {
  :root { --radius: 12px; }
  body { font-size: 15px; }
  .topbar { height: 60px; padding: 0 12px; }
  .logo { font-size: 16px; }
  .topbar nav a, .topbar nav span { font-size: 14px; }
  .container { margin-top: 78px; }
  .card { padding: 16px; }
  .tx-row { gap: 10px; }
  .badge { font-size: 12px; }
  input, textarea, select { font-size: 15px; }
  .tx-card__head { flex-direction: column; align-items: flex-start; }
  .tx-card__meta { flex-direction: column; align-items: flex-start; gap: 6px; }
  .tx-line { flex-direction: column; align-items: flex-start; }
  .tx-amount { font-size: 18px; }
  .chat-panel { padding: 14px 12px; }
}

@media (max-width: 340px) {
  .topbar nav { gap: 6px; }
  .topbar nav a, .topbar nav span { padding: 6px 0; }
  .btn, button { width: 100%; text-align: center; }
  .card-head { flex-direction: column; align-items: flex-start; }
}
