:root {
  color-scheme: dark;
  --bg: #090b10;
  --bg-elevated: #11151f;
  --bg-soft: #171d2a;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #f5f7fb;
  --muted: #98a2b3;
  --accent: #5b8cff;
  --accent-2: #3dd9b7;
  --danger: #ff6b7a;
  --warning: #ffb84d;
  --radius: 20px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, Segoe UI, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(91, 140, 255, 0.18), transparent 32%),
    radial-gradient(circle at top right, rgba(61, 217, 183, 0.1), transparent 28%),
    var(--bg);
  color: var(--text);
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 390px 1fr;
}

.sidebar {
  padding: 24px;
  border-right: 1px solid var(--line);
  background: rgba(7, 10, 16, 0.85);
  backdrop-filter: blur(16px);
}

.content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.brand h1,
.panel-header h2,
.hero h2 {
  margin: 0;
}

.brand p,
.panel-header p,
.hero p,
.hint,
.card-subtitle,
.balance-description,
.connection-meta {
  margin: 0;
  color: var(--muted);
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-weight: 700;
  color: white;
}

.panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.panel + .panel {
  margin-top: 16px;
}

.panel-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.row {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}

.form,
.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
}

input,
select,
button {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-soft);
  color: var(--text);
  padding: 13px 14px;
  font: inherit;
}

input:focus,
select:focus {
  outline: 2px solid rgba(91, 140, 255, 0.35);
  border-color: rgba(91, 140, 255, 0.4);
}

button {
  cursor: pointer;
  transition: 0.2s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.primary {
  background: linear-gradient(135deg, var(--accent), #7f5bff);
  border-color: transparent;
}

.secondary {
  background: rgba(255, 255, 255, 0.04);
}

.danger {
  background: linear-gradient(135deg, #ff5e7a, #ff944d);
  border-color: transparent;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.hero-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent-2);
  box-shadow: 0 0 18px rgba(61, 217, 183, 0.8);
}

.grid {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 20px;
}

.connections-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.connection-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.connection-card.active {
  border-color: rgba(91, 140, 255, 0.45);
  box-shadow: 0 0 0 1px rgba(91, 140, 255, 0.2) inset;
}

.connection-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 12px;
}

.balances-root {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.balance-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
}

.balance-head {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.balance-table {
  width: 100%;
  border-collapse: collapse;
}

.balance-table th,
.balance-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.balance-table tr:last-child td {
  border-bottom: none;
}

.number {
  font-variant-numeric: tabular-nums;
}

.empty-state {
  min-height: 220px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  color: var(--muted);
}

.summary-box {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.summary-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
}

.summary-item strong {
  display: block;
  margin-bottom: 6px;
}

.log {
  min-height: 120px;
  max-height: 260px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.log-item {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  white-space: pre-wrap;
}

.log-item.error {
  border-color: rgba(255, 107, 122, 0.35);
  color: #ffd2d7;
}

.hidden {
  display: none !important;
}

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

  .grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 640px) {
  .content,
  .sidebar {
    padding: 14px;
  }

  .hero,
  .row,
  .summary-box {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .summary-box {
    display: flex;
    flex-direction: column;
  }
}
