:root {
  --bg: #070b11;
  --bg-soft: #0b1118;
  --panel: #0d141d;
  --panel-2: #111a24;
  --line: rgba(189, 203, 219, 0.12);
  --line-strong: rgba(189, 203, 219, 0.2);
  --text: #edf2f7;
  --muted: #92a1b3;
  --accent: #8dd4ff;
  --accent-soft: rgba(141, 212, 255, 0.12);
  --positive: #6fd6b3;
  --danger: #ff8d94;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(141, 212, 255, 0.06), transparent 28%),
    var(--bg);
}

.shell {
  width: min(760px, calc(100% - 24px));
  margin: 0 auto;
  padding: 20px 0 40px;
}

.page-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.page-tab {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
}

.page-tab-active {
  color: var(--text);
  border-color: rgba(141, 212, 255, 0.22);
  background: rgba(141, 212, 255, 0.08);
}

.hero {
  display: grid;
  gap: 14px;
  margin-bottom: 12px;
  padding: 4px 0 14px;
  border-bottom: 1px solid var(--line);
}

.hero-copy {
  display: grid;
  gap: 6px;
}

.kicker,
.stat-label,
.field-label,
.result-label,
.history-chart-label {
  margin: 0;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
  color: var(--muted);
}

h1,
.group-title,
.wallet-label,
.inline-history-title {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.03em;
}

h1 {
  font-size: clamp(1.7rem, 3.2vw, 2.25rem);
  line-height: 1.05;
}

.lede,
.status,
.hint,
.result-address,
.group-meta,
.wallet-meta,
.wallet-error,
.inline-history-meta,
.history-empty,
.history-chart-range,
.chart-tooltip-date,
.history-chart-axis,
.empty-page-copy {
  color: var(--muted);
  line-height: 1.5;
}

.lede {
  max-width: 44rem;
  margin: 0;
  font-size: 0.92rem;
}

.stats-grid,
.groups-grid,
.group-items,
.auth-form,
.admin-users,
.logs-list,
.lookup-form,
.history-table,
.hero-copy {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.stat-card,
.panel,
.group-card,
.auth-card,
.result,
.chart-card,
.inline-history {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border-radius: 14px;
}

.stat-card {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: baseline;
  padding: 12px 14px;
}

.stat-value {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  text-align: right;
}

.stat-value-small {
  font-size: 0.82rem;
  max-width: 20ch;
}

.panel {
  margin-top: 12px;
  padding: 14px;
}

.empty-page-state {
  display: grid;
  gap: 8px;
  min-height: 140px;
  align-content: center;
}

.empty-page-copy {
  margin: 0;
  font-size: 0.94rem;
}

.auth-card {
  margin-top: 12px;
  padding: 14px;
}

.panel-head {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.tabs-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.tab-button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.tab-button-active {
  color: var(--text);
  border-color: rgba(141, 212, 255, 0.22);
  background: rgba(141, 212, 255, 0.08);
}

.admin-tab-panel {
  display: grid;
  gap: 12px;
}

.admin-tab-panel[hidden] {
  display: none !important;
}

.exchange-tab-panel[hidden] {
  display: none !important;
}

.hero-actions,
.session-buttons,
.admin-user-head,
.admin-user-actions,
.admin-user-grid,
.logs-toolbar,
.log-head,
.log-meta-row {
  display: flex;
  gap: 10px;
}

.hero-actions,
.admin-user-head {
  justify-content: space-between;
  align-items: center;
}

.session-buttons,
.admin-user-actions,
.logs-toolbar,
.log-meta-row {
  flex-wrap: wrap;
}

.session-badge {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.015);
}

.session-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.nav-button {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.wallet-input,
.submit-button {
  min-height: 42px;
  border-radius: 10px;
}

.wallet-input {
  width: 100%;
  padding: 0 13px;
  border: 1px solid var(--line);
  font: inherit;
  color: var(--text);
  background: rgba(8, 12, 18, 0.92);
}

.wallet-input:focus {
  outline: none;
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(141, 212, 255, 0.08);
}

.submit-button {
  padding: 0 14px;
  border: 1px solid var(--line);
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}

.submit-button:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--line-strong);
}

.secondary-button {
  justify-self: start;
}

.submit-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.auth-form {
  margin-top: 10px;
}

.hint {
  margin: 0;
  font-size: 0.8rem;
}

.group-card {
  padding: 12px;
}

.admin-user-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.015);
}

.admin-credential-summary,
.exchange-assets,
.exchange-transfer-stats,
.exchange-transfer-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.admin-credential-summary {
  margin-top: 12px;
}

.admin-credential-card,
.exchange-asset-row {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.015);
}

.exchange-assets {
  margin-top: 12px;
}

.exchange-transfer-stats,
.exchange-transfer-list {
  margin-top: 12px;
}

.exchange-asset-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.exchange-asset-values {
  text-align: right;
}

.exchange-asset-values strong,
.exchange-asset-values span {
  display: block;
}

.exchange-asset-values span {
  margin-top: 2px;
  color: var(--muted);
}

.exchange-transfer-stat,
.exchange-transfer-row {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.015);
}

.exchange-transfer-row-deposit {
  border-color: rgba(111, 214, 179, 0.18);
  background: rgba(111, 214, 179, 0.035);
}

.exchange-transfer-row-withdrawal {
  border-color: rgba(255, 141, 148, 0.18);
  background: rgba(255, 141, 148, 0.035);
}

.exchange-transfer-head,
.exchange-transfer-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.exchange-transfer-head {
  justify-content: space-between;
  align-items: flex-start;
}

.exchange-transfer-amount {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 700;
}

.logs-toolbar {
  margin-bottom: 12px;
  align-items: end;
}

.admin-user-grid {
  margin-top: 10px;
  align-items: end;
  flex-wrap: wrap;
}

.admin-user-grid > * {
  flex: 1 1 220px;
}

.admin-user-info {
  display: grid;
  gap: 4px;
}

.admin-user-info span {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.admin-user-info strong {
  font-size: 0.95rem;
}

.admin-user-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.role-badge,
.state-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.state-badge-active {
  color: var(--positive);
}

.state-badge-inactive {
  color: var(--danger);
}

.admin-user-actions {
  margin-top: 12px;
}

.log-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.015);
}

.log-card-error {
  border-color: rgba(255, 141, 148, 0.26);
}

.log-card-warn {
  border-color: rgba(245, 181, 68, 0.26);
}

.log-head {
  justify-content: space-between;
  align-items: center;
}

.log-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.log-message {
  margin: 10px 0 0;
  color: var(--text);
  line-height: 1.5;
}

.log-context {
  margin-top: 10px;
}

.log-context summary {
  cursor: pointer;
  color: var(--muted);
}

.log-context pre {
  margin: 8px 0 0;
  padding: 10px;
  overflow: auto;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
  font-size: 0.76rem;
  line-height: 1.45;
}

.group-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.group-head-button {
  width: 100%;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.group-head-main {
  min-width: 0;
}

.group-head-side {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.group-total {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.group-caret {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.88rem;
  color: var(--muted);
}

.group-card-collapsed .group-head {
  margin-bottom: 0;
}

.wallet-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 11px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.015);
}

.wallet-row-clickable {
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}

.wallet-row-clickable:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--line);
}

.wallet-row-active {
  border-color: rgba(141, 212, 255, 0.22);
  background: rgba(141, 212, 255, 0.04);
}

.wallet-row-error {
  border-color: rgba(255, 141, 148, 0.22);
}

.wallet-values {
  text-align: right;
}

.wallet-values strong,
.wallet-values span {
  display: block;
}

.wallet-values span {
  margin-top: 2px;
  color: var(--muted);
}

.wallet-meta,
.group-meta,
.wallet-error,
.inline-history-meta {
  margin: 2px 0 0;
  word-break: break-all;
  font-size: 0.77rem;
}

.inline-history {
  padding: 10px;
  background: rgba(255, 255, 255, 0.015);
}

.inline-history-head {
  margin-bottom: 8px;
}

.chart-card {
  padding: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.01), rgba(255, 255, 255, 0.01)),
    linear-gradient(180deg, #0e151e, #0d141d);
}

.history-chart-shell {
  display: grid;
  gap: 10px;
}

.history-chart-head {
  display: grid;
  gap: 8px;
}

.history-chart-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.history-chart-stats span {
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.015);
  font-size: 0.73rem;
  color: var(--text);
}

.history-chart-frame {
  position: relative;
  height: 220px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: #0a1118;
}

.history-chart-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.chart-grid-line {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1;
}

.chart-grid-value {
  fill: rgba(146, 161, 179, 0.72);
  font-size: 11px;
  text-anchor: end;
}

.chart-grid-value-left {
  text-anchor: start;
}

.chart-grid-value-right {
  text-anchor: end;
}

.chart-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-line-btc {
  stroke: #f5b544;
}

.chart-line-eth {
  stroke: #76a8ff;
}

.chart-crosshair {
  stroke: rgba(255, 255, 255, 0.24);
  stroke-width: 1;
  stroke-dasharray: 4 6;
}

.chart-focus-point {
  fill: var(--accent);
  stroke: #0a1118;
  stroke-width: 2;
}

.chart-focus-point-btc {
  fill: #f5b544;
}

.chart-focus-point-eth {
  fill: #76a8ff;
}

.chart-tooltip {
  position: absolute;
  width: 180px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(9, 13, 20, 0.96);
  pointer-events: none;
}

.chart-tooltip-value {
  margin: 0;
  color: var(--text);
}

.chart-tooltip-market {
  width: 190px;
}

.market-btc-chip,
.market-btc-tooltip {
  color: #f5b544;
}

.market-eth-chip,
.market-eth-tooltip {
  color: #76a8ff;
}

.history-chart-axis {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.74rem;
}

.history-table {
  margin-top: 8px;
  gap: 6px;
}

.history-table-head,
.history-row {
  display: grid;
  grid-template-columns: 1.5fr 0.8fr 1fr 1fr;
  gap: 12px;
  align-items: start;
}

.history-table-head {
  padding: 0 8px;
  font-size: 0.67rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.history-row {
  padding: 9px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.015);
  font-size: 0.81rem;
}

.history-direction {
  text-transform: uppercase;
  font-weight: 700;
}

.history-direction.in {
  color: var(--positive);
}

.history-direction.out,
.history-direction.fee {
  color: var(--danger);
}

.history-direction.self {
  color: var(--accent);
}

.result {
  margin-top: 12px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.015);
}

.result-balance {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 6px;
}

.result-balance span {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.04em;
}

.result-balance small {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.result-address {
  margin: 8px 0 0;
  word-break: break-all;
}

.status {
  margin: 10px 0 0;
  min-height: 1.4em;
  font-size: 0.8rem;
}

.status.error {
  color: var(--danger);
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 16px, 760px);
    padding: 14px 0 24px;
  }

  .panel,
  .group-card,
  .stat-card,
  .result,
  .inline-history {
    border-radius: 12px;
  }

  .group-head,
  .hero-actions,
  .wallet-row,
  .admin-user-head,
  .admin-user-grid,
  .logs-toolbar,
  .log-head,
  .history-table-head,
  .history-row {
    grid-template-columns: 1fr;
    display: grid;
  }

  .wallet-values {
    text-align: left;
  }

  .history-chart-frame {
    height: 200px;
  }
}
