:root {
  color-scheme: dark;
  --bg: #071012;
  --panel: #10191d;
  --panel-2: #162125;
  --line: rgba(209, 242, 232, 0.14);
  --text: #eef8f5;
  --muted: #91a6a1;
  --soft: #c4d6d1;
  --aave: #b6509e;
  --mint: #57d7b9;
  --blue: #6ca4ff;
  --amber: #ffbf66;
  --red: #ff6b7d;
  --green: #69df98;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(182, 80, 158, 0.14), transparent 36%),
    radial-gradient(circle at 84% 8%, rgba(87, 215, 185, 0.12), transparent 30%),
    var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  border-right: 1px solid var(--line);
  background: rgba(7, 16, 18, 0.74);
  backdrop-filter: blur(18px);
}

.brand,
.nav-item,
.source-panel a,
.status-pill,
.icon-button,
.select-wrap,
.search-wrap,
.text-button,
.key-row button {
  display: inline-flex;
  align-items: center;
}

.brand {
  width: 100%;
  gap: 12px;
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 34px;
}

.brand img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  gap: 10px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 650;
}

.nav-item svg {
  width: 18px;
  height: 18px;
}

[data-lucide] {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
}

[data-lucide] svg,
.lucide {
  display: block;
  flex: 0 0 auto;
}

.nav-item.active,
.nav-item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--line);
}

.source-panel {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 22px;
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.panel-label,
.eyebrow,
.tile-label,
.metric-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.source-panel a {
  justify-content: space-between;
  color: var(--soft);
  font-size: 13px;
}

.main {
  min-width: 0;
  padding: 26px;
}

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

.topbar h1,
.hero-signal h2,
.panel h3 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: clamp(30px, 4vw, 52px);
  line-height: 1;
}

.eyebrow {
  margin: 0 0 8px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-pill {
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--soft);
  font-size: 13px;
  font-weight: 700;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 18px var(--amber);
}

.status-pill.live .status-dot {
  background: var(--green);
  box-shadow: 0 0 18px var(--green);
}

.status-pill.warn .status-dot {
  background: var(--red);
  box-shadow: 0 0 18px var(--red);
}

.icon-button,
.key-row button {
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
}

.icon-button:hover,
.key-row button:hover,
.text-button:hover {
  border-color: rgba(87, 215, 185, 0.48);
}

.icon-button svg,
.key-row button svg {
  width: 18px;
  height: 18px;
}

.spinning svg {
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.hero-signal {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 22px;
  align-items: end;
  min-height: 260px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(110deg, rgba(7, 16, 18, 0.46), rgba(7, 16, 18, 0.88)),
    url("https://images.unsplash.com/photo-1640340434855-6084b1f4901c?auto=format&fit=crop&w=1600&q=80") center / cover;
  box-shadow: var(--shadow);
}

.market-tag,
.mini-badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(87, 215, 185, 0.35);
  border-radius: 999px;
  background: rgba(87, 215, 185, 0.12);
  color: var(--mint);
  font-size: 12px;
  font-weight: 800;
}

.hero-signal h2 {
  max-width: 850px;
  margin-top: 16px;
  font-size: clamp(32px, 5vw, 72px);
  line-height: 0.98;
}

.hero-signal p {
  max-width: 720px;
  margin: 18px 0 0;
  color: var(--soft);
  font-size: 16px;
  line-height: 1.6;
}

.price-tile {
  min-height: 170px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 16, 18, 0.72);
}

.price-tile strong {
  display: block;
  margin: 14px 0 12px;
  font-size: 42px;
}

.change,
.signal-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.up {
  color: var(--green);
  background: rgba(105, 223, 152, 0.12);
}

.down {
  color: var(--red);
  background: rgba(255, 107, 125, 0.12);
}

.neutral {
  color: var(--soft);
  background: rgba(255, 255, 255, 0.08);
}

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

.metric-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 25, 29, 0.88);
}

.metric-card {
  position: relative;
  min-height: 132px;
  padding: 18px;
}

.metric-card strong {
  display: block;
  margin: 12px 0 8px;
  font-size: 30px;
}

.metric-card small {
  color: var(--muted);
}

.move-card {
  overflow: hidden;
}

.move-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--line);
}

.move-card strong {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  width: fit-content;
  padding: 0;
  border-radius: 0;
  background: transparent;
  font-size: 32px;
  letter-spacing: 0;
}

.move-card strong::after {
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.move-card strong.up {
  color: #8ff0b4;
}

.move-card strong.up::after {
  content: "UP";
  color: rgba(143, 240, 180, 0.72);
}

.move-card:has(strong.up)::before {
  background: linear-gradient(180deg, rgba(143, 240, 180, 0.95), rgba(143, 240, 180, 0.18));
}

.move-card strong.down {
  color: #ff8fa0;
}

.move-card strong.down::after {
  content: "DOWN";
  color: rgba(255, 143, 160, 0.72);
}

.move-card:has(strong.down)::before {
  background: linear-gradient(180deg, rgba(255, 143, 160, 0.95), rgba(255, 143, 160, 0.18));
}

.move-card strong.neutral {
  color: var(--soft);
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(340px, 0.9fr);
  gap: 16px;
  align-items: start;
}

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

.panel.wide {
  grid-column: 1;
  grid-row: 2;
}

.side-stack {
  display: grid;
  grid-column: 2;
  grid-row: 2;
  gap: 16px;
  align-self: start;
}

.distributions-panel {
  grid-column: 1 / -1;
  grid-row: 1;
}

#whales,
#governance {
  grid-column: auto;
  grid-row: auto;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.panel-header.compact {
  align-items: center;
}

.panel h3 {
  font-size: 20px;
}

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

.select-wrap,
.search-wrap {
  gap: 8px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--muted);
}

.select-wrap svg,
.search-wrap svg {
  width: 17px;
  height: 17px;
}

select,
input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

select {
  min-width: 150px;
  color-scheme: dark;
  background: var(--panel-2);
}

select option {
  background: var(--panel-2);
  color: var(--text);
}

input::placeholder {
  color: #6f817d;
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

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

.sort-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: inherit;
  font-weight: 800;
  text-transform: inherit;
}

.sort-button:hover,
.sort-button.active {
  color: var(--text);
}

.sort-button span {
  display: inline-flex;
  width: 10px;
  color: var(--mint);
}

td {
  color: var(--soft);
  font-size: 14px;
}

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

.asset-cell {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  vertical-align: middle;
}

.asset-cell > span:last-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.asset-logo,
.asset-fallback {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
}

.asset-logo {
  object-fit: contain;
  background: rgba(255, 255, 255, 0.08);
}

.asset-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: rgba(87, 215, 185, 0.12);
  color: var(--mint);
  font-size: 10px;
  font-weight: 800;
}

.signal-cell {
  display: grid;
  gap: 5px;
  max-width: 220px;
  white-space: normal;
}

.signal-reason {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

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

.distribution-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  max-height: 760px;
  overflow: auto;
  padding: 18px;
}

.distribution-card,
.empty-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.empty-card {
  grid-column: 1 / -1;
  color: var(--muted);
  text-align: center;
}

.distribution-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.distribution-top .asset-cell {
  overflow: hidden;
}

.distribution-top strong {
  flex: 0 0 auto;
  color: var(--text);
  font-size: 18px;
}

.up-text {
  color: #8ff0b4 !important;
}

.down-text {
  color: #ff8fa0 !important;
}

.rate-compare {
  display: grid;
  gap: 8px;
  margin: 14px 0 12px;
}

.rate-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 58px;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.rate-row strong {
  color: var(--soft);
  font-size: 11px;
  text-align: right;
}

.rate-track {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.rate-track i {
  display: block;
  height: 100%;
  min-width: 2px;
  border-radius: inherit;
}

.supply-segment {
  background: linear-gradient(90deg, #57d7b9, #7ce6cf);
}

.borrow-segment {
  background: linear-gradient(90deg, #ff8fa0, #ffbf66);
}

.distribution-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
}

.distribution-meta span {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.key-row,
.threshold-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 16px 18px 0;
}

.key-row input {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.threshold-row {
  grid-template-columns: 92px minmax(0, 1fr) 44px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.whale-list,
.news-list {
  display: grid;
  gap: 10px;
  padding: 18px;
}

.governance-feed {
  margin-top: 0;
}

.governance-feed .news-list {
  grid-template-columns: 1fr;
}

.whale-item,
.news-item {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.investor-badge {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 0 9px 0 6px;
  border: 1px solid rgba(196, 214, 209, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--soft);
  font-size: 12px;
  font-weight: 800;
}

.investor-badge small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.investor-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: currentColor;
  font-size: 13px;
  line-height: 1;
}

.investor-badge.micro,
.investor-badge.retail,
.investor-badge.neutral {
  color: #bad0cc;
}

.investor-badge.steady,
.investor-badge.active {
  border-color: rgba(108, 164, 255, 0.24);
  color: #9fc1ff;
}

.investor-badge.large {
  border-color: rgba(255, 191, 102, 0.28);
  color: #ffd18a;
}

.investor-badge.whale {
  border-color: rgba(87, 215, 185, 0.32);
  background: rgba(87, 215, 185, 0.11);
  color: #7ce6cf;
}

.investor-badge.mega {
  border-color: rgba(182, 80, 158, 0.4);
  background: rgba(182, 80, 158, 0.14);
  color: #f0a3df;
}

.item-title {
  color: var(--text);
  font-weight: 800;
}

.item-meta {
  color: var(--muted);
  font-size: 12px;
}

.address {
  overflow: hidden;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  text-overflow: ellipsis;
}

.text-button {
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--mint);
  font-size: 13px;
  font-weight: 800;
}

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

  .sidebar {
    position: static;
    height: auto;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 16px;
    padding: 14px;
  }

  .brand {
    margin: 0;
  }

  .nav-list {
    display: flex;
    overflow-x: auto;
  }

  .source-panel {
    display: none;
  }

  .workspace-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

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

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

  .side-stack {
    grid-column: 1 / -1;
    grid-row: auto;
  }
}

@media (max-width: 760px) {
  .main {
    padding: 16px;
  }

  .topbar,
  .hero-signal,
  .panel-header,
  .item-top {
    align-items: stretch;
    flex-direction: column;
  }

  .hero-signal,
  .metric-grid,
  .workspace-grid {
    grid-template-columns: 1fr;
  }

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

  .hero-signal {
    min-height: 420px;
    padding: 20px;
  }

  .topbar-actions,
  .controls {
    width: 100%;
  }

  .status-pill,
  .select-wrap,
  .search-wrap {
    flex: 1;
  }

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

  .nav-item {
    flex: 0 0 auto;
  }
}
