:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-soft: #eef4ef;
  --text: #17211b;
  --muted: #647067;
  --border: #dfe5de;
  --accent: #1f8f5f;
  --accent-dark: #146445;
  --blue: #4467e8;
  --red: #d64b55;
  --cyan: #1a91b8;
  --shadow: 0 18px 46px rgba(23, 33, 27, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 48px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.08;
  font-weight: 760;
}

.topbar p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.controls {
  display: flex;
  align-items: end;
  gap: 10px;
}

.controls label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.controls input {
  width: 164px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 0 12px;
  font-size: 14px;
  box-shadow: 0 1px 0 rgba(23, 33, 27, 0.04);
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--text);
  color: #fff;
  cursor: pointer;
}

.icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.icon-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.summary-panel,
.panel,
.wallet-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.summary-panel {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 1fr 1.35fr;
  gap: 1px;
  overflow: hidden;
  margin-bottom: 16px;
}

.summary-panel > div {
  min-height: 104px;
  padding: 20px;
  background: var(--surface);
}

.label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 740;
  letter-spacing: 0;
  text-transform: uppercase;
}

.summary-panel strong {
  font-size: 30px;
  line-height: 1;
  font-weight: 780;
}

.summary-panel .status {
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.wallet-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.wallet-card {
  padding: 18px;
  min-height: 156px;
}

.wallet-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.network {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.network-icon {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.network-icon.tron {
  background: var(--red);
}

.network-icon.eth {
  background: var(--blue);
}

.network-icon.ton {
  background: var(--cyan);
}

.network h2 {
  font-size: 16px;
  line-height: 1.2;
}

.network span,
.wallet-address,
.wallet-foot {
  color: var(--muted);
  font-size: 12px;
}

.wallet-amount {
  margin-bottom: 12px;
  font-size: 27px;
  line-height: 1;
  font-weight: 780;
}

.wallet-address {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wallet-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.wallet-error {
  color: #a23a42;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(340px, 0.9fr) minmax(0, 1.25fr);
  gap: 16px;
}

.panel {
  min-width: 0;
  padding: 18px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.panel-heading h2 {
  font-size: 17px;
  line-height: 1.2;
}

.panel-heading span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.chart {
  display: grid;
  grid-template-columns: repeat(var(--days, 31), minmax(4px, 1fr));
  align-items: end;
  gap: 5px;
  height: 262px;
  padding: 12px 0 0;
}

.bar {
  position: relative;
  min-height: 3px;
  border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, #31ac76 0%, #18704d 100%);
}

.bar.zero {
  background: #dce4dd;
}

.bar::after {
  content: attr(data-day);
  position: absolute;
  right: 50%;
  bottom: -22px;
  transform: translateX(50%);
  color: var(--muted);
  font-size: 10px;
  opacity: 0;
}

.bar:nth-child(5n + 1)::after,
.bar:last-child::after {
  opacity: 1;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 13px;
}

th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

td {
  color: #273129;
}

.amount-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.hash {
  max-width: 210px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-cell {
  height: 132px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 900px) {
  .topbar,
  .controls {
    align-items: stretch;
    flex-direction: column;
  }

  .controls {
    display: grid;
    grid-template-columns: 1fr 42px;
    width: 100%;
  }

  .controls input {
    width: 100%;
  }

  .summary-panel,
  .wallet-grid,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .summary-panel > div {
    min-height: 86px;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 20px;
  }

  h1 {
    font-size: 28px;
  }

  .summary-panel strong {
    font-size: 25px;
  }

  .wallet-card,
  .panel,
  .summary-panel > div {
    padding: 15px;
  }

  .chart {
    gap: 3px;
    height: 220px;
  }
}
