:root {
  --bg: #0d0f14;
  --bg-card: #151922;
  --border: #2a3144;
  --text: #e8ecf4;
  --muted: #8b95a8;
  --accent: #c43b4a;
  --accent-soft: #e85d6f;
  --link: #6eb5ff;
  --success: #3ecf8e;
  --error: #ff7b7b;
  --mono: "JetBrains Mono", "Fira Code", Consolas, monospace;
  --sans: "Segoe UI", system-ui, sans-serif;
  --radius: 10px;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: var(--sans); background: var(--bg); color: var(--text); min-height: 100vh; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { width: min(960px, 94vw); margin: 0 auto; padding: 2rem 0 4rem; }

.site-header { background: #1a1020; border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; gap: 1rem; padding: 0.9rem 0; flex-wrap: wrap; }
.brand { display: flex; gap: 0.5rem; align-items: center; color: var(--text); font-weight: 700; }
.brand-gem { color: var(--accent-soft); }
.nav-links { display: flex; gap: 1rem; flex-wrap: wrap; }
.nav-links a { color: var(--muted); font-weight: 500; }
.logout-form { margin-left: auto; }

.btn, button.btn {
  background: var(--accent); color: #fff; border: none; border-radius: var(--radius);
  padding: 0.65rem 1.1rem; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block;
}
.btn:hover { background: var(--accent-soft); text-decoration: none; }
.btn-small { padding: 0.4rem 0.8rem; font-size: 0.85rem; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }

.utxo-panel .muted { color: var(--muted); margin: 0 0 1rem; line-height: 1.5; }

.hero h1 { margin: 0 0 1rem; }
.accent { color: var(--accent-soft); }
.muted { color: var(--muted); }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.stat-card.highlight { border-color: var(--accent); }
.stat-label { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; }
.stat-value { font-size: 1.4rem; font-weight: 700; margin-top: 0.3rem; }
.unit { font-size: 0.9rem; color: var(--muted); font-weight: 500; }

.panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 1.2rem; overflow: hidden; }
.highlight-panel { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(196, 59, 74, 0.25); }
.nav-links a.nav-warn { color: var(--accent-soft); font-weight: 700; }
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: 1rem; border-bottom: 1px solid var(--border); }
.panel-head h2 { margin: 0; font-size: 1rem; }
.panel-body { padding: 1rem; }
.stack { display: flex; flex-direction: column; gap: 0.75rem; align-items: flex-start; }

.address-box {
  display: block; background: #0a0c10; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.85rem; font-family: var(--mono); font-size: 0.9rem; word-break: break-all;
}

.stack-form { display: flex; flex-direction: column; gap: 1rem; max-width: 480px; }
.stack-form label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.9rem; color: var(--muted); }
.stack-form input {
  background: #0a0c10; border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius); padding: 0.65rem 0.8rem; font-size: 1rem;
}
.inline-form { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.inline-form input {
  background: #0a0c10; border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius); padding: 0.5rem 0.75rem;
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 0.7rem 1rem; border-bottom: 1px solid var(--border); text-align: left; }
th { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; background: #1c2130; }
.mono { font-family: var(--mono); font-size: 0.85em; }
.empty { text-align: center; color: var(--muted); }

.badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 999px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; }
.badge-send { background: #3a2020; color: #ff8a80; }
.badge-receive { background: #1e3a2a; color: #7dffb8; }
.badge-immature, .badge-generate { background: #3a3520; color: #ffd666; }
.badge-mined { background: #2a2848; color: #c4b0ff; }
.badge-active { background: #1a3328; color: var(--success); }
.badge-pending { background: #2a3048; color: #9eb8ff; }
.badge-redeemed { background: #2a3048; color: #9eb8ff; }
.gift-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.gift-code-display { font-size: 1.1rem; letter-spacing: 0.04em; }
.referral-link-display { font-size: 0.95rem; letter-spacing: 0.02em; }
.badge-discord-linked { background: #2a3050; color: #9eb8ff; }
.badge-discord-joined { background: #1a3328; color: var(--success); }
.badge-registered { background: #332a2a; color: #ffb08a; }
.live-feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.live-feed li { padding: 0.55rem 0.75rem; background: #0a0c10; border: 1px solid var(--border); border-radius: var(--radius); }
.admin-grid { display: grid; gap: 1rem; max-width: 640px; }
.admin-grid label { display: flex; flex-direction: column; gap: 0.35rem; color: var(--muted); }
.admin-grid input { background: #0a0c10; border: 1px solid var(--border); color: var(--text); border-radius: var(--radius); padding: 0.65rem 0.8rem; }
.admin-hint { grid-column: 1 / -1; line-height: 1.5; }
.admin-head .action-row { margin-top: 0.75rem; }
.backup-hint-list { margin: 0.5rem 0 1rem; padding-left: 1.2rem; line-height: 1.5; }
.backup-create-form { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; margin: 0.75rem 0; }
.backup-full-toggle { display: flex; align-items: center; gap: 0.5rem; color: var(--muted); font-size: 0.9rem; }
.backup-status-active { color: #9eb8ff; }
.backup-actions { white-space: nowrap; }
.backup-actions .btn-small { margin-right: 0.35rem; }
.admin-backup-panel { margin-bottom: 1.25rem; }
.badge-utxo-spendable { background: #1a3328; color: var(--success); }
.badge-utxo-immature { background: #3a3520; color: #ffd666; }
.badge-utxo-unconfirmed { background: #2a3048; color: #9eb8ff; }
.badge-utxo-locked { background: #332a2a; color: #ffb08a; }
.inline-form { display: inline; margin: 0; }
.row-primary { background: rgba(125, 255, 184, 0.06); }
.row-primary td { border-color: rgba(125, 255, 184, 0.15); }
.maturity-bar {
  margin-top: 0.35rem; height: 4px; background: #2a3144; border-radius: 2px; max-width: 8rem; overflow: hidden;
}
.maturity-fill { height: 100%; background: #ffd666; border-radius: 2px; transition: width 0.2s ease; }
.filter-row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.btn-active { background: var(--accent-soft); }
.page-head h1 { margin: 0 0 0.35rem; }
.page-head .muted { margin: 0 0 1rem; }

.flash-wrap { margin-bottom: 1rem; }
.flash { padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 0.5rem; }
.flash-success { background: #1a3328; color: var(--success); border: 1px solid #2d5a45; }
.flash-error { background: #331a1a; color: var(--error); border: 1px solid #5a2d2d; }

.login-card, .success-card {
  max-width: 420px; margin: 4rem auto; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2rem;
}
.login-card h1, .success-card h1 { margin-top: 0; }

.confirm-dl { display: grid; grid-template-columns: 120px 1fr; gap: 0.75rem 1rem; margin-bottom: 1.5rem; }
.confirm-dl dt { color: var(--muted); }
.confirm-dl dd { margin: 0; word-break: break-all; }
.action-row { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.pager { padding: 1rem; display: flex; gap: 0.75rem; }
.user-pill { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; }
.wide-form { max-width: 520px; }
.hint { font-size: 0.8rem; color: var(--muted); }
.warn-box, .danger-panel { border: 1px solid #6b3030; background: #2a1518; border-radius: var(--radius); padding: 1rem; margin: 1rem 0; }
.hidden { position: absolute; left: -9999px; }
.checkbox-label { flex-direction: row !important; align-items: center; gap: 0.5rem; color: var(--text) !important; }
.hero-sub { color: var(--muted); }
.empty { text-align: center; color: var(--muted); }

@media (max-width: 700px) {
  .header-inner { flex-direction: column; align-items: stretch; }
  .logout-form { margin-left: 0; }
}