.right-panel {
  width: 320px;
  min-width: 320px;
  height: 100vh;
  position: sticky;
  top: 0;
  background-color: var(--background);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transition: width 0.3s ease, min-width 0.3s ease;
}

.right-panel.collapsed {
  width: 0;
  min-width: 0;
  overflow: hidden;
  border-left: none;
}

.right-panel-toggle {
  position: absolute;
  left: -28px;
  top: 12px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--table_bg);
  border: 1px solid var(--table_border);
  border-right: none;
  border-radius: 6px 0 0 6px;
  cursor: pointer;
  z-index: 5;
  color: var(--table_text_color);
  transition: background-color 0.2s;
}

.right-panel-toggle:hover {
  background-color: var(--table_hover_bg);
}

.right-panel-toggle .material-symbols-rounded {
  font-size: 18px;
  transition: transform 0.3s ease;
}

.right-panel.collapsed .right-panel-toggle .material-symbols-rounded {
  transform: rotate(180deg);
}

.right-panel-content {
  padding: var(--global-gap);
  display: flex;
  flex-direction: column;
  gap: var(--global-gap);
}

/* Search in right panel */
.rp-search {
  position: relative;
}

.rp-search .top-bar-search-wrapper {
  position: relative;
}

.rp-search .search-results-dropdown {
  top: calc(100% + 4px);
}

/* Token Header */
.rp-token-header {
  margin-top: calc(var(--global-gap) * 2);
  display: flex;
  align-items: center;
  gap: 10px;
}

.rp-token-logo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: var(--table_header_bg);
  border: 1px solid var(--table_border);
  flex-shrink: 0;
  overflow: hidden;
}

.rp-token-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rp-token-logo-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-placeholder);
}

.rp-token-symbol {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-hover-primary);
  flex-shrink: 0;
}

.rp-token-name {
  font-size: 13px;
  color: var(--table_text_color);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Contracts Dropdown */
.rp-contracts {
  position: relative;
  display: none;
}

.rp-contracts-toggle {
  display: inline-flex;
  align-items: center;
  padding: 4px 0;
  cursor: pointer;
}

.rp-contracts-selected {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
}

.rp-chain-icon {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-placeholder);
  text-transform: capitalize;
  flex-shrink: 0;
}

.rp-contract-addr {
  font-size: 12px;
  color: var(--table_text_color);
  font-family: monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* extends .btn-icon from base.css */
.rp-copy-btn {
  margin: 0;
  flex-shrink: 0;
}
.rp-copy-btn .material-symbols-rounded {
  font-size: 14px !important;
}

.rp-contracts-arrow.material-symbols-rounded {
  font-size: 14px !important;
  color: var(--color-text-placeholder);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.rp-contracts.open .rp-contracts-arrow {
  transform: rotate(180deg);
}

.rp-contracts-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  background-color: var(--table_bg);
  border: 1px solid var(--table_border);
  border-radius: 6px;
  box-shadow: 0 6px 16px var(--color-shadow);
  z-index: 100;
  max-height: 200px;
  overflow-y: auto;
}

.rp-contracts.open .rp-contracts-dropdown {
  display: block;
}

.rp-contract-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.rp-contract-item:hover {
  background-color: var(--table_hover_bg);
}

.rp-contract-item .rp-chain-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--table_text_color);
  text-transform: capitalize;
  min-width: 60px;
  flex-shrink: 0;
}

.rp-contract-item .rp-contract-addr {
  font-size: 10px;
  flex: 1;
}

/* Divider */
.rp-divider {
  border: none;
  border-top: 1px solid var(--table_border);
  margin: 2px 0;
}

/* Sections */
.rp-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rp-section-title {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--color-text-placeholder);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Info Rows */
.rp-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 8px;
  border: 1px solid var(--table_border);
  border-radius: var(--radius-md);
}

/* Price row */
.rp-price-row {
}

.rp-price-value {
  font-size: 15px !important;
  font-weight: 500 !important;
  letter-spacing: -0.3px;
}

.rp-info-label {
  font-size: var(--fs-xs);
  color: var(--color-text-placeholder);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-weight: 500;
}

.rp-info-value {
  font-size: var(--fs-base);
  font-weight: var(--font_weight);
  color: var(--table_text_color);
  font-variant-numeric: tabular-nums;
}

/* Info Grid (2 columns) */
.rp-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.rp-info-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 5px 8px;
  border: 1px solid var(--table_border);
  border-radius: var(--radius-md);
}

/* Sector cell — holds a pill, needs overflow visible */
.rp-sector-cell {
  overflow: visible;
}
.rp-sector-cell .rp-info-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--fs-xs);
}

/* Placeholder */
.rp-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 16px 8px;
  color: var(--color-text-placeholder);
  font-size: 12px;
}

.rp-placeholder .material-symbols-rounded {
  font-size: 32px;
  opacity: 0.4;
}

/* ── Change colors ────────────────────────────────────────────────── */
.rp-info-value.positive { color: var(--color-positive); }
.rp-info-value.negative { color: var(--color-negative); }

/* ── Rank coloring (mirrors tokens table) ─────────────────────────── */
.rp-rank-gold   { color: #f59e0b; font-weight: 500; }
.rp-rank-silver { color: var(--color-muted); font-weight: 500; }

/* ── Right-panel tokens mini-table ────────────────────────────────── */
.rp-tokens-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.rp-tokens-table thead th {
  padding: 4px 6px;
  color: var(--color-text-placeholder);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-bottom: 1px solid var(--table_border);
  white-space: nowrap;
  background: var(--background);
  position: sticky;
  top: 0;
}
.rp-th-token { text-align: left; }
.rp-th-num   { text-align: right; }
.rp-token-row {
  cursor: pointer;
  transition: background var(--duration-fast);
}
.rp-token-row:hover { background: var(--table_hover_bg); }
.rp-token-row:nth-child(odd)  { background: var(--table_row_odd_bg); }
.rp-token-row:nth-child(even) { background: var(--table_row_even_bg); }
.rp-token-row:hover { background: var(--table_hover_bg) !important; }
.rp-td-token {
  padding: 3px 6px;
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
}
.rp-td-num {
  padding: 3px 6px;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--table_text_color);
}
.rp-tok-logo {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
}
.rp-tok-logo-fb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-hover-primary);
  color: #fff;
  font-size: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.rp-tok-sym {
  font-weight: 500;
  color: var(--table_text_color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 70px;
}
.rp-tok-sector {
  font-size: 10px;
  color: var(--color-text-placeholder);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Sortable header ───────────────────────────────────────────────── */
.rp-th-sort {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.rp-th-sort:hover { color: var(--table_text_color); }
.rp-th-active { color: var(--color-hover-primary) !important; }
.rp-sort-arrow { margin-left: 2px; font-size: 9px; }

/* ── Active sort column highlight ─────────────────────────────────── */
.rp-tokens-table[data-sort="price"] td:nth-child(2),
.rp-tokens-table[data-sort="chg_24h"] td:nth-child(3),
.rp-tokens-table[data-sort="chg_7d"] td:nth-child(4) {
  background: rgba(110, 142, 251, 0.035);
}

/* Token page: right panel overlays chart area, bottom aligns with chart box */
body.token-page .right-panel {
  position: absolute;
  right: 0;
  top: 0;
  height: calc(var(--global-gap) + (100vh - 3 * var(--global-gap)) * 0.4);
  overflow-y: auto;
}

/* Responsive */
@media (max-width: 1024px) {
  .right-panel {
    display: none;
  }
}
