:root {
  color-scheme: dark;
  --bg: #0b0f12;
  --surface: #11171b;
  --surface-2: #182025;
  --surface-3: #202a30;
  --line: #263238;
  --line-soft: #1c262b;
  --text: #eef5f2;
  --muted: #8ea09a;
  --accent: #43d99a;
  --accent-2: #78b7ff;
  --danger: #ff6b7a;
  --warning: #f2c96d;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at top left, rgba(67, 217, 154, 0.12), transparent 360px),
    linear-gradient(180deg, #0d1317 0%, var(--bg) 46%);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

.app-shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

.topbar,
.status-strip,
.panel,
.metric {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.18);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(360px, 720px);
  gap: 18px;
  align-items: end;
  padding: 20px;
  background:
    linear-gradient(135deg, rgba(67, 217, 154, 0.10), transparent 44%),
    var(--surface);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 32px;
  line-height: 1.15;
}

.title-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.version-badge {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 48%, var(--line));
  border-radius: 999px;
  background: rgba(67, 217, 154, 0.10);
  color: var(--accent);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

h2 {
  font-size: 17px;
  line-height: 1.3;
}

.account-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.address-display {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.address-display strong {
  min-height: 44px;
  display: flex;
  align-items: center;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0a0e11;
  color: var(--text);
  padding: 0 12px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 15px;
  font-weight: 700;
}

.primary-button {
  min-height: 44px;
  border: 0;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #59e2ab, var(--accent));
  color: #06100c;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 0 20px;
}

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

.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding: 12px 16px;
  background: rgba(17, 23, 27, 0.82);
}

.status-strip > div {
  display: flex;
  gap: 8px;
  align-items: center;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.toggle {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.toggle input {
  accent-color: var(--accent);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.metric {
  min-height: 104px;
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent),
    var(--surface);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 14px;
  overflow-wrap: anywhere;
  font-size: 22px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.panel {
  min-width: 0;
  overflow: hidden;
}

.panel.wide {
  grid-column: 1 / -1;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 54px;
  border-bottom: 1px solid var(--line-soft);
  padding: 0 16px;
  background: var(--surface-2);
}

.badge {
  display: inline-flex;
  min-width: 28px;
  min-height: 24px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

th,
td {
  height: 44px;
  border-bottom: 1px solid var(--line-soft);
  padding: 0 16px;
  text-align: right;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

th:first-child,
td:first-child {
  text-align: left;
}

th {
  color: var(--muted);
  font-weight: 600;
  background: #0d1215;
  position: sticky;
  top: 0;
  z-index: 1;
}

td {
  color: var(--text);
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: rgba(120, 183, 255, 0.055);
}

.fills-table td:nth-child(2) {
  font-weight: 800;
}

.compact {
  max-height: 420px;
}

.empty-row td {
  height: 96px;
  color: var(--muted);
  text-align: center;
}

.positive {
  color: var(--accent);
}

.negative {
  color: var(--danger);
}

.warning {
  color: var(--warning);
}

.muted-value {
  color: var(--muted);
}

@media (max-width: 1100px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 20px, 720px);
    padding-top: 10px;
  }

  .topbar,
  .account-panel,
  .content-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 26px;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .status-strip {
    align-items: flex-start;
    flex-direction: column;
  }
}
