/* tokenclub dashboard. Design tokens mirror website_3/index.html so the app
   and the marketing site read as one product. Keep them in sync by hand. */

:root {
  --bg-0: #07060f;
  --bg-1: #0c0a1c;
  --bg-2: #120e29;
  --ink: #f4f2ff;
  --ink-dim: #b9b4d6;
  --ink-mute: #837da3;

  --violet: #8b5cff;
  --violet-bright: #a879ff;
  --indigo: #5b6bff;
  --blue: #37b6ff;
  --cyan: #4fe9d6;
  --magenta: #d16bff;
  --danger: #ff6b8b;

  --glass-bg: rgba(255, 255, 255, 0.045);
  --glass-bg-hi: rgba(255, 255, 255, 0.075);
  --glass-brd: rgba(174, 158, 255, 0.16);
  --glass-brd-hi: rgba(174, 158, 255, 0.42);

  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 26px;
  --radius-pill: 999px;

  --shadow-sm: 0 4px 20px rgba(0, 0, 0, 0.35);
  --shadow: 0 18px 50px rgba(10, 4, 40, 0.55);

  --sp-1: 8px;
  --sp-2: 16px;
  --sp-3: 24px;
  --sp-4: 40px;
  --sp-5: 64px;

  --maxw: 880px;

  --grad-brand: linear-gradient(120deg, #a879ff 0%, #5b6bff 42%, #37b6ff 100%);
  --grad-text: linear-gradient(100deg, #ffffff 0%, #c9b8ff 45%, #7fd9ff 100%);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-0);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Ambient glow, fixed so it doesn't scroll with content. */
body::before {
  content: '';
  position: fixed;
  top: -320px; left: 50%;
  width: 900px; height: 900px;
  max-width: 140vw;
  transform: translateX(-50%);
  background: conic-gradient(from 120deg, var(--violet), var(--blue), var(--cyan), var(--magenta), var(--violet));
  filter: blur(140px);
  opacity: 0.20;
  z-index: -1;
  pointer-events: none;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3 {
  font-family: 'Space Grotesk', sans-serif;
  letter-spacing: -0.02em;
  line-height: 1.12;
  font-weight: 700;
}

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

.grad-text {
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600; font-size: 0.95rem;
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .3s ease, background .3s ease, border-color .2s;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

.btn-primary {
  background: var(--grad-brand);
  color: #0a0620;
  box-shadow: 0 10px 30px rgba(91, 107, 255, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 16px 42px rgba(139, 91, 255, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.btn-ghost {
  background: var(--glass-bg);
  color: var(--ink);
  border: 1px solid var(--glass-brd);
  backdrop-filter: blur(12px);
}
.btn-ghost:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: var(--glass-brd-hi);
  background: var(--glass-bg-hi);
}

.btn-sm { padding: 8px 16px; font-size: 0.86rem; }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(255, 107, 139, 0.28);
}
.btn-danger:hover:not(:disabled) {
  background: rgba(255, 107, 139, 0.1);
  border-color: rgba(255, 107, 139, 0.55);
}

.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-brd);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border-radius: var(--radius);
}

/* ---------- Logo / nav ---------- */
.logo {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700; font-size: 1.18rem; letter-spacing: -0.03em;
}
.logo-mark { width: 30px; height: 30px; flex: none; }
.logo b {
  font-weight: 700;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.topbar { padding: 20px 0 var(--sp-4); }
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2);
  padding: 10px 14px 10px 18px;
  background: rgba(12, 10, 28, 0.55);
  border: 1px solid var(--glass-brd);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
}
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-email {
  font-size: 0.88rem; color: var(--ink-dim);
  max-width: 30ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- Login ---------- */
.login-shell {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-4) 20px;
}
.login-card {
  width: 100%; max-width: 420px;
  padding: var(--sp-4) var(--sp-3);
  text-align: center;
  box-shadow: var(--shadow);
}
.login-card .logo { margin-bottom: var(--sp-3); }
.login-card h1 { font-size: 1.85rem; margin-bottom: 10px; }
.login-card p.sub { color: var(--ink-dim); font-size: 0.98rem; margin-bottom: var(--sp-3); }
.login-card .btn { width: 100%; padding: 14px 22px; font-size: 1rem; }
.login-fine {
  margin-top: var(--sp-3);
  font-size: 0.8rem; color: var(--ink-mute);
}
.login-fine a { color: var(--ink-dim); text-decoration: underline; text-underline-offset: 3px; }

.g-icon { width: 18px; height: 18px; flex: none; }

/* ---------- Page header ---------- */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--sp-2); flex-wrap: wrap;
  margin-bottom: var(--sp-3);
}
.page-head h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); }
.page-head p { color: var(--ink-dim); font-size: 0.95rem; margin-top: 6px; }

.balance-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.balance {
  display: inline-flex; align-items: baseline; gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  background: var(--glass-bg);
  border: 1px solid var(--glass-brd);
}
.balance .label { font-size: 0.78rem; color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.08em; }
.balance .value { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 1.1rem; }
.balance .crediting {
  font-size: 0.78rem; color: var(--cyan);
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.4; } }

/* ---------- Key list ---------- */
.panel { padding: var(--sp-3); box-shadow: var(--shadow); }

.key-row {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: 16px 0;
  border-bottom: 1px solid var(--glass-brd);
}
.key-row:last-child { border-bottom: none; }
.key-row:first-child { padding-top: 0; }

.key-main { flex: 1 1 auto; min-width: 0; }
.key-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600; font-size: 1rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.key-name.untitled { color: var(--ink-mute); font-weight: 500; font-style: italic; }
.key-meta {
  display: flex; gap: 12px; flex-wrap: wrap;
  font-size: 0.84rem; color: var(--ink-mute); margin-top: 3px;
}
.key-meta .prefix { color: var(--ink-dim); }

.empty {
  text-align: center; padding: var(--sp-4) var(--sp-2);
  color: var(--ink-mute);
}
.empty h3 { color: var(--ink-dim); font-size: 1.05rem; margin-bottom: 8px; }

.skeleton {
  height: 58px; border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--glass-bg) 25%, var(--glass-bg-hi) 50%, var(--glass-bg) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  margin-bottom: 10px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- Create form ---------- */
.create-row { display: flex; gap: 10px; margin-bottom: var(--sp-3); flex-wrap: wrap; }
.create-row input {
  flex: 1 1 240px;
  font-family: inherit; font-size: 0.95rem;
  color: var(--ink);
  padding: 12px 18px;
  border-radius: var(--radius-pill);
  background: var(--glass-bg);
  border: 1px solid var(--glass-brd);
  transition: border-color .2s, background .2s;
}
.create-row input::placeholder { color: var(--ink-mute); }
.create-row input:focus {
  outline: none;
  border-color: var(--glass-brd-hi);
  background: var(--glass-bg-hi);
}

/* ---------- New-key reveal ---------- */
.reveal-card {
  padding: var(--sp-3);
  margin-bottom: var(--sp-3);
  border: 1px solid rgba(79, 233, 214, 0.35);
  background: rgba(79, 233, 214, 0.06);
  border-radius: var(--radius);
}
.reveal-card h3 { font-size: 1.05rem; margin-bottom: 6px; }
.reveal-card p { font-size: 0.88rem; color: var(--ink-dim); margin-bottom: 14px; }
.reveal-key {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.reveal-key code {
  flex: 1 1 280px; min-width: 0;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.86rem;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: rgba(7, 6, 15, 0.7);
  border: 1px solid var(--glass-brd);
  overflow-x: auto;
  white-space: nowrap;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px;
  transform: translateX(-50%) translateY(12px);
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  background: rgba(12, 10, 28, 0.92);
  border: 1px solid var(--glass-brd-hi);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  z-index: 100;
  max-width: calc(100vw - 40px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-color: rgba(255, 107, 139, 0.6); color: var(--danger); }

/* ---------- Confirm dialog ---------- */
dialog {
  border: none; padding: 0; background: transparent; color: var(--ink);
  max-width: 100%;
  /* The `* { margin: 0 }` reset clobbers the UA's `margin: auto`, which is what
     centres a modal <dialog> inside its inset:0 box. Put it back. */
  margin: auto;
}
dialog::backdrop { background: rgba(7, 6, 15, 0.72); backdrop-filter: blur(4px); }
.dialog-card {
  width: min(420px, calc(100vw - 40px));
  padding: var(--sp-3);
  background: var(--bg-1);
  border: 1px solid var(--glass-brd-hi);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.dialog-card h3 { font-size: 1.15rem; margin-bottom: 10px; }
.dialog-card p { color: var(--ink-dim); font-size: 0.92rem; margin-bottom: var(--sp-3); }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- Top-up amount picker ---------- */
.amount-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin-bottom: var(--sp-3);
}
.amount {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600; font-size: 0.95rem;
  color: var(--ink-dim);
  padding: 12px 4px;
  border-radius: var(--radius-sm);
  background: var(--glass-bg);
  border: 1px solid var(--glass-brd);
  cursor: pointer;
  transition: border-color .2s, background .2s, color .2s;
}
.amount:hover { color: var(--ink); border-color: var(--glass-brd-hi); }
.amount.selected {
  color: var(--ink);
  border-color: var(--violet-bright);
  background: rgba(139, 91, 255, 0.16);
}

/* ---------- Page footer ---------- */
.page-foot {
  margin: var(--sp-5) auto var(--sp-4);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--glass-brd);
  font-size: 0.85rem;
  color: var(--ink-mute);
  text-align: center;
}
.page-foot a {
  color: var(--ink-dim);
  border-bottom: 1px solid var(--glass-brd-hi);
  transition: color .2s;
}
.page-foot a:hover { color: var(--ink); }

@media (max-width: 560px) {
  .key-row { flex-wrap: wrap; }
  .page-head { align-items: flex-start; }
  .user-email { display: none; }
}
