:root {
  --bg: #0a0e12;
  --bg-elevated: #0f1419;
  --ink: #e7edf2;
  --ink-soft: #c5d0d8;
  --muted: #8494a1;
  --muted-2: #5c6b78;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --surface: #121820;
  --surface-2: #171e27;
  --surface-3: #1c2530;
  --accent: #2fd39a;
  --accent-dim: #1fa876;
  --accent-soft: rgba(47, 211, 154, 0.12);
  --accent-glow: rgba(47, 211, 154, 0.22);
  --warn: #e8b45c;
  --danger: #f07167;
  --ok: #2fd39a;
  --info: #6eb6ff;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 12px 40px rgba(0, 0, 0, 0.28);
  --shadow-sm: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
  --font: "IBM Plex Sans", "Segoe UI", sans-serif;
  --display: "IBM Plex Sans", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 248px;
  --content-max: 1180px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 50% at 0% -10%, rgba(47, 211, 154, 0.09), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(110, 182, 255, 0.06), transparent 50%),
    linear-gradient(180deg, #0c1116 0%, var(--bg) 40%, #080b0e 100%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration: none; transition: color 0.15s var(--ease); }
a:hover { color: #5eefb8; }

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ——— Sidebar ——— */
.sidebar {
  padding: 1.35rem 1rem 1.25rem;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(15, 20, 25, 0.97), rgba(10, 14, 18, 0.98));
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 20;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--ink);
  text-decoration: none;
  padding: 0.15rem 0.35rem;
}
.brand:hover { text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 2rem;
  height: 2rem;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--accent) 0%, var(--accent-dim) 100%);
  color: #04140f;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1rem;
  box-shadow: 0 0 0 1px rgba(47, 211, 154, 0.35), 0 8px 20px rgba(47, 211, 154, 0.18);
}
.brand-text {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.1;
}
.brand-text span {
  color: var(--muted);
  font-weight: 500;
  letter-spacing: -0.02em;
}
.brand-tag {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.nav-section {
  display: grid;
  gap: 0.35rem;
}
.nav-label {
  padding: 0 0.75rem;
  margin: 0.35rem 0 0.15rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.side-nav { display: grid; gap: 0.2rem; }
.side-nav a {
  position: relative;
  padding: 0.58rem 0.8rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 500;
  font-size: 0.92rem;
  text-decoration: none;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.side-nav a:hover {
  background: var(--surface-2);
  color: var(--ink-soft);
  text-decoration: none;
}
.side-nav a.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(47, 211, 154, 0.2);
}
.side-nav a.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.side-user {
  margin-top: auto;
  display: grid;
  gap: 0.65rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.side-user-meta {
  padding: 0 0.35rem;
}
.side-user-label {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 0.2rem;
}
.side-email {
  font-size: 0.82rem;
  color: var(--ink-soft);
  word-break: break-all;
  line-height: 1.35;
}

.main-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.main-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 14, 18, 0.55);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.main-topbar-title {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.main-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.wrap {
  width: min(var(--content-max), calc(100% - 3rem));
  margin: 0 auto;
  padding: 1.75rem 0 3.5rem;
  flex: 1;
}
.site-footer {
  width: min(var(--content-max), calc(100% - 3rem));
  margin: 0 auto;
  padding: 0 0 2rem;
  color: var(--muted-2);
  font-size: 0.8rem;
  border-top: 1px solid var(--line);
  padding-top: 1.25rem;
}
.site-footer p { margin: 0; max-width: 42rem; line-height: 1.5; }

/* ——— Page header ——— */
.page-head {
  display: flex;
  justify-content: space-between;
  gap: 1.25rem;
  align-items: flex-start;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
}
.page-head h1 {
  font-family: var(--display);
  font-size: clamp(1.65rem, 2.8vw, 2.05rem);
  margin: 0;
  letter-spacing: -0.04em;
  font-weight: 600;
  line-height: 1.15;
}
.lede {
  color: var(--muted);
  max-width: 40rem;
  line-height: 1.55;
  margin: 0.45rem 0 0;
  font-size: 0.95rem;
}
.badge-row { display: flex; gap: 0.45rem; flex-wrap: wrap; align-items: center; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.01em;
}
.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted-2);
  flex-shrink: 0;
}
.badge.ok {
  background: var(--accent-soft);
  color: var(--ok);
  border-color: rgba(47, 211, 154, 0.25);
}
.badge.ok::before { background: var(--ok); box-shadow: 0 0 8px var(--accent-glow); }
.badge.bad {
  background: rgba(240, 113, 103, 0.12);
  color: var(--danger);
  border-color: rgba(240, 113, 103, 0.28);
}
.badge.bad::before { background: var(--danger); }
a.badge { text-decoration: none; cursor: pointer; }
a.badge:hover { filter: brightness(1.08); }

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.2rem;
  height: 1.2rem;
  padding: 0 0.35rem;
  margin-left: 0.35rem;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  vertical-align: middle;
}

/* ——— KPI strip ——— */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-bottom: 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.kpi {
  background: transparent;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  padding: 1.15rem 1.2rem;
  box-shadow: none;
  position: relative;
  transition: background 0.2s var(--ease);
}
.kpi:last-child { border-right: 0; }
.kpi:hover { background: rgba(255, 255, 255, 0.015); }
.kpi span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.45rem;
}
.kpi strong {
  font-size: 1.55rem;
  letter-spacing: -0.03em;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.kpi .sub {
  margin-top: 0.45rem;
  font-size: 0.78rem;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}
.pos { color: var(--ok); }
.neg { color: var(--danger); }

/* ——— Panels / grids ——— */
.dash-grid {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 1rem;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem 1.25rem;
  box-shadow: var(--shadow-sm);
}
.panel h2 {
  margin: 0 0 1rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.panel-head h2 { margin: 0; }

.section-block {
  margin-bottom: 1.5rem;
}

.actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin: 1.1rem 0;
}
button, .btn {
  font: inherit;
  padding: 0.62rem 1.05rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: linear-gradient(180deg, #3adba6 0%, var(--accent) 100%);
  color: #04140f;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: filter 0.15s var(--ease), transform 0.15s var(--ease), border-color 0.15s var(--ease);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset;
}
button:hover, .btn:hover {
  filter: brightness(1.05);
  text-decoration: none;
  transform: translateY(-1px);
}
button:active, .btn:active { transform: translateY(0); }
button.ghost, .ghost, a.btn.ghost {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--line-strong);
  box-shadow: none;
}
button.ghost:hover, a.btn.ghost:hover {
  background: var(--surface-2);
  border-color: var(--line-strong);
  color: var(--ink);
}
.full { width: 100%; }
button:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.stack { display: grid; gap: 0.85rem; max-width: 28rem; }
.stack label, .row label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
}
input, select {
  font: inherit;
  padding: 0.68rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--bg-elevated);
  color: var(--ink);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
input:focus, select:focus {
  outline: none;
  border-color: rgba(47, 211, 154, 0.45);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input::placeholder { color: var(--muted-2); }

.flash {
  width: min(var(--content-max), calc(100% - 3rem));
  margin: 1rem auto 0;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.9rem;
}
main .flash, .deposit-panel .flash, .journey-panel .flash, #hl-wallet-status {
  width: auto;
  margin: 0.75rem 0;
}
.flash-error {
  border-color: rgba(240, 113, 103, 0.4);
  background: rgba(240, 113, 103, 0.1);
  color: #ffb4ae;
}
.flash-ok {
  border-color: rgba(47, 211, 154, 0.35);
  background: var(--accent-soft);
  color: var(--ok);
}
.flash-info {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--ink-soft);
}
.muted { color: var(--muted); }
.ok { color: var(--ok); }
.bad { color: var(--danger); }

.journey-steps {
  list-style: none;
  padding: 0;
  margin: 1rem 0 1.15rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  counter-reset: journey;
}
.journey-steps li {
  counter-increment: journey;
  display: grid;
  gap: 0.25rem;
  padding: 0.9rem 0.95rem 0.9rem 2.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  position: relative;
  min-height: 4.5rem;
}
.journey-steps li::before {
  content: counter(journey);
  position: absolute;
  left: 0.85rem;
  top: 0.95rem;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface-3);
  border: 1px solid var(--line);
}
.journey-steps li strong { font-size: 0.9rem; color: var(--ink); }
.journey-steps li span { color: var(--muted); font-size: 0.8rem; line-height: 1.4; }
.journey-steps li.is-done {
  border-color: rgba(47, 211, 154, 0.35);
  background: var(--accent-soft);
}
.journey-steps li.is-done::before {
  content: "✓";
  color: #04140f;
  background: var(--accent);
  border-color: transparent;
}
.journey-steps li.is-done strong { color: var(--ok); }
.journey-steps li.is-done strong::before { content: none; }

code, .mono {
  font-family: var(--mono);
  font-size: 0.84em;
  background: var(--surface-3);
  padding: 0.12rem 0.4rem;
  border-radius: 5px;
  border: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
table.data th, table.data td {
  text-align: left;
  padding: 0.7rem 0.5rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.data th {
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
table.data tbody tr:hover td {
  background: rgba(255, 255, 255, 0.015);
}

.wallet-list, .fills, .steps { list-style: none; padding: 0; margin: 0; }
.wallet-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--line);
  align-items: center;
  flex-wrap: wrap;
}
.wallet-list li:last-child { border-bottom: 0; }
.wallet-list li form { margin: 0; }
.steps {
  list-style: decimal;
  padding-left: 1.25rem;
  color: var(--muted);
  line-height: 1.55;
}
.steps li { margin: 0.55rem 0; }
.steps strong { color: var(--ink); }

.activity-row {
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  gap: 0.85rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}
.activity-row:last-child { border-bottom: 0; }
.activity-row time {
  color: var(--muted-2);
  font-size: 0.78rem;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.hero-auth {
  max-width: 26rem;
  margin: 3rem auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  padding: 2rem 1.75rem;
  box-shadow: var(--shadow);
}
.hero-auth h1 {
  font-family: var(--display);
  font-size: 1.75rem;
  margin: 0 0 0.4rem;
  letter-spacing: -0.035em;
  font-weight: 600;
}

.card-lite {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem 1.25rem;
  margin: 0.75rem 0;
  box-shadow: var(--shadow-sm);
}
.card-lite h2 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--ink);
}
.bal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin: 0.9rem 0;
}
.bal-grid > div {
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
}
.bal-grid span {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 0.3rem;
}
.bal-grid strong {
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  word-break: break-all;
}
.deposit-panel { margin-top: 0.75rem; }
.deposit-panel + .deposit-panel { margin-top: 1rem; }
.deposit-form { max-width: 28rem; }
.journey-panel h2 {
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  text-transform: none;
  color: var(--ink);
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.inline { display: inline; }
.row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: end; }
.empty {
  padding: 1.75rem 1.25rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.01);
}

@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    gap: 1rem;
  }
  .side-nav { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
  .side-user { border-top: 0; padding-top: 0; }
  .main-topbar { display: none; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi:nth-child(2n) { border-right: 0; }
  .kpi:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .dash-grid { grid-template-columns: 1fr; }
  .journey-steps { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi { border-right: 0; border-bottom: 1px solid var(--line); }
  .kpi:last-child { border-bottom: 0; }
  .wrap, .site-footer, .flash { width: calc(100% - 1.5rem); }
  .page-head { gap: 0.85rem; }
}
