:root {
  color-scheme: light;
  --bg: #f3fff8;
  --panel: #fffefb;
  --panel-strong: #edf9f1;
  --ink: #13201c;
  --muted: #68736f;
  --line: #d5e3da;
  --line-strong: #a9c6b7;
  --green: #068866;
  --green-soft: #dcf8eb;
  --red: #d6455d;
  --red-soft: #fde7ec;
  --gold: #c89513;
  --gold-soft: #fff1c9;
  --blue: #1f7fb1;
  --blue-soft: #e1f5ff;
  --shadow: 0 18px 42px rgba(16, 42, 32, 0.12);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(6, 136, 102, 0.07) 0 10%, transparent 10% 25%, rgba(31, 127, 177, 0.055) 25% 36%, transparent 36% 52%, rgba(214, 69, 93, 0.045) 52% 62%, transparent 62%),
    linear-gradient(180deg, #f7fff8 0%, #f3fbff 50%, #fffaf5 100%);
  background-size: 80px 80px, auto;
  color: var(--ink);
  overflow-x: hidden;
}

body.is-panning {
  cursor: grabbing;
  user-select: none;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  cursor: grab;
}

button {
  cursor: pointer;
}

input,
select,
canvas {
  cursor: auto;
}

.topbar {
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  justify-items: center;
  gap: 16px;
  min-height: 86px;
  padding: 14px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(17, 31, 27, 0.95);
  color: #f8fff7;
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  color: inherit;
  text-decoration: none;
}

.brand-center {
  padding: 6px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(246, 201, 69, 0.08));
}

.brand-mark {
  display: grid;
  grid-template-columns: repeat(2, 12px);
  grid-template-rows: repeat(2, 12px);
  gap: 3px;
  width: 32px;
  height: 32px;
}

.brand-mark span {
  border-radius: 3px;
}

.brand-mark span:nth-child(1) {
  background: #20c997;
}

.brand-mark span:nth-child(2) {
  background: #f6c945;
}

.brand-mark span:nth-child(3) {
  background: #39a8d8;
}

.brand-mark span:nth-child(4) {
  background: #ef5d75;
}

.brand-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.brand-copy strong {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  font-size: 27px;
  line-height: 1.1;
  text-transform: uppercase;
}

.brand-copy strong span {
  color: #f8fff7;
}

.brand-copy strong em {
  color: #f6c945;
  font-style: normal;
}

.brand-copy small {
  color: rgba(248, 255, 247, 0.72);
  font-size: 12px;
  text-align: center;
}

.status-pill,
.score-badge,
.mini-stat {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.ghost-button,
.icon-button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 800;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.ghost-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.ghost-button,
.icon-button {
  background: var(--panel);
  color: var(--ink);
  border-color: var(--line);
}

.refresh-button {
  min-width: 86px;
  padding: 0 13px;
  border-color: rgba(6, 136, 102, 0.28);
  background: linear-gradient(135deg, #ffffff, var(--green-soft));
  color: var(--green);
}

.refresh-button:hover {
  background: var(--green-soft);
}

.icon-button {
  width: 38px;
  padding: 0;
}

.full {
  width: 100%;
}

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

.eyebrow,
label span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.workspace {
  display: grid;
  grid-template-columns: 360px minmax(560px, 1fr);
  gap: 14px;
  align-items: start;
}

.market-panel,
.insight-panel {
  min-width: 0;
}

.market-panel,
.token-brief,
.bubble-panel,
.utility-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 254, 251, 0.98), rgba(248, 255, 252, 0.98));
  box-shadow: var(--shadow);
}

.market-panel {
  max-height: 760px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

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

.panel-heading > div {
  min-width: 0;
}

.panel-heading.compact {
  padding: 14px 14px 8px;
}

.panel-heading h1,
.panel-heading h2,
.token-title h2,
.chart-header h2 {
  margin: 2px 0 0;
  font-size: 19px;
  line-height: 1.1;
}

.search-box,
.sort-row label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.search-box {
  margin: 0 16px 12px;
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfffd;
  color: var(--ink);
  padding: 0 11px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(17, 127, 91, 0.13);
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin: 0 16px 12px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #eaf8f1;
}

.segmented-control button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.segmented-control button.active {
  background: #fffefb;
  color: var(--ink);
  box-shadow: 0 4px 12px rgba(16, 42, 32, 0.08);
}

.sort-row {
  padding: 0 16px 12px;
}

.token-list {
  overflow: auto;
  padding: 0 8px 10px;
}

.token-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 72px;
  margin-bottom: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: inherit;
  text-align: left;
}

.token-row:hover,
.token-row.active {
  background: #fbfffd;
  border-color: var(--line);
}

.token-row.active {
  box-shadow: inset 3px 0 0 var(--gold);
}

.token-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(6, 136, 102, 0.14), rgba(246, 201, 69, 0.2), rgba(31, 127, 177, 0.14)),
    #fff;
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
}

.token-row .token-avatar {
  width: 36px;
  height: 36px;
  font-size: 13px;
}

.token-row strong,
.risk-item strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.token-row small,
.token-meta-line,
.risk-item small {
  color: var(--muted);
  font-size: 12px;
}

.token-price {
  display: grid;
  justify-items: end;
  gap: 5px;
  font-size: 12px;
  font-weight: 900;
}

.change-up {
  color: var(--green);
}

.change-down {
  color: var(--red);
}

.insight-panel {
  display: grid;
  gap: 14px;
}

.token-brief {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 106px;
  padding: 18px;
}

.token-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.token-title > div {
  min-width: 0;
}

.token-title p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.price-stack {
  display: grid;
  justify-items: end;
  gap: 5px;
  min-width: 145px;
}

.price-stack span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.price-stack strong {
  font-size: 24px;
}

.price-stack small {
  font-size: 13px;
  font-weight: 900;
}

.bubble-panel {
  padding: 14px;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.holder-flow {
  display: grid;
  grid-template-columns: 170px 28px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  min-height: 170px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(6, 136, 102, 0.08), rgba(31, 127, 177, 0.07)),
    #fbfffd;
  padding: 12px;
}

.flow-token,
.flow-tier {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffefb;
  padding: 12px;
}

.flow-token {
  display: grid;
  align-content: center;
  gap: 8px;
  border-color: rgba(17, 127, 91, 0.28);
  box-shadow: inset 4px 0 0 var(--green);
}

.flow-token strong {
  font-size: 28px;
  line-height: 1;
}

.flow-token small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.flow-arrow {
  position: relative;
}

.flow-arrow::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--line-strong);
}

.flow-arrow::after {
  content: "";
  position: absolute;
  top: calc(50% - 5px);
  right: 0;
  border-left: 8px solid var(--line-strong);
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.flow-tiers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.flow-tier {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.flow-tier > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.flow-tier > strong {
  font-size: 24px;
  line-height: 1;
}

.flow-tier.whale {
  box-shadow: inset 4px 0 0 var(--red);
}

.flow-tier.top {
  box-shadow: inset 4px 0 0 var(--gold);
}

.flow-tier.tail {
  box-shadow: inset 4px 0 0 var(--blue);
}

.tier-bar {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--panel-strong);
}

.tier-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.tier-holders {
  display: grid;
  gap: 6px;
}

.tier-holder {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfffd;
  color: inherit;
  padding: 0 7px;
  text-align: left;
}

.tier-holder span,
.tier-holder small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.tier-holder strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.tier-holders em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.holder-table-card {
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffefb;
}

.holder-table-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.holder-table-heading strong {
  font-size: 14px;
}

.holder-table-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.holder-table-wrap {
  max-height: 320px;
  overflow: auto;
}

.holder-row {
  cursor: pointer;
}

.holder-row:hover,
.holder-row.active {
  background: var(--green-soft);
}

.holder-row code {
  font-family: inherit;
  font-weight: 900;
}

.holder-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
}

.holder-status.locked {
  background: var(--gold-soft);
  color: var(--gold);
}

.table-wrap {
  overflow: auto;
  max-height: 330px;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 9px 12px;
  border-top: 1px solid var(--line);
  text-align: right;
  font-size: 12px;
}

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

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

td {
  font-weight: 800;
}

.utility-card {
  padding-bottom: 14px;
}

.risk-list {
  display: grid;
  gap: 8px;
  padding: 0 16px;
}

.risk-item {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  min-height: 44px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfffd;
}

.risk-dot {
  width: 10px;
  height: 10px;
  margin-top: 4px;
  border-radius: 999px;
  background: var(--gold);
}

.risk-dot.good {
  background: var(--green);
}

.risk-dot.bad {
  background: var(--red);
}

.risk-item strong {
  display: block;
  font-size: 12px;
}

.risk-item small {
  color: var(--muted);
  font-size: 11px;
}

.empty-state {
  padding: 22px 14px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 40;
  max-width: min(420px, calc(100% - 40px));
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #111f1b;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 18px 50px rgba(31, 36, 28, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1320px) {
  .workspace {
    grid-template-columns: 320px minmax(480px, 1fr);
  }
}

@media (max-width: 980px) {
  .topbar {
    position: static;
    grid-template-columns: 1fr;
  }

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

  .market-panel {
    position: static;
    max-height: 620px;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: 100%;
    padding: 18px 10px 32px;
  }

  .workspace,
  .market-panel,
  .insight-panel,
  .token-brief,
  .bubble-panel,
  .utility-card {
    width: 100%;
    max-width: calc(100vw - 20px);
  }

  .brand-copy strong {
    font-size: 24px;
  }

  .panel-heading {
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 14px;
  }

  .refresh-button {
    min-width: 78px;
    padding: 0 10px;
  }

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

  .token-row {
    grid-template-columns: 36px minmax(0, 1fr);
    align-items: start;
    min-height: 86px;
  }

  .token-price {
    grid-column: 2;
    justify-items: start;
    grid-template-columns: repeat(3, auto);
    align-items: center;
    gap: 8px;
  }

  .token-brief {
    align-items: flex-start;
    flex-direction: column;
  }

  .price-stack {
    justify-items: start;
  }

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

  .flow-arrow {
    min-height: 28px;
  }

  .flow-arrow::before {
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    height: auto;
  }

  .flow-arrow::after {
    left: calc(50% - 5px);
    right: auto;
    top: auto;
    bottom: 0;
    border-top: 8px solid var(--line-strong);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 0;
  }

  th,
  td {
    padding: 8px;
  }
}
