.ks-token-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.62);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.ks-token-modal-overlay[data-open="true"] {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.ks-token-modal {
  width: min(480px, calc(100vw - 32px));
  max-height: min(80dvh, 780px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  background: #1b1b1b;
  color: var(--ks-text, #fff);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
  transform: scale(0.98) translateY(8px);
  transition: transform 180ms ease;
}

.ks-token-modal-overlay[data-open="true"] .ks-token-modal {
  transform: scale(1) translateY(0);
}

.ks-token-modal-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 20px 10px;
}

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

.ks-token-modal-title {
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}

.ks-token-icon-muted {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #969696;
  line-height: 1;
}

.ks-token-icon-muted svg {
  width: 15px;
  height: 15px;
  stroke-width: 2;
}

.ks-token-modal-close,
.ks-chain-toggle,
.ks-token-icon-button,
.ks-token-tab,
.ks-token-pill,
.ks-token-row,
.ks-token-sort,
.ks-token-load-more {
  font-family: inherit;
}

.ks-token-modal-close {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #d8d8d8;
  font-size: 25px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  transition: color 140ms ease, background-color 140ms ease;
}

.ks-token-modal-close:hover,
.ks-token-modal-close:focus {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.ks-token-search-row {
  flex: 0 0 auto;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 66px;
  gap: 10px;
  padding: 0 20px 12px;
}

.ks-token-search-wrap {
  position: relative;
  min-width: 0;
}

.ks-token-search {
  width: 100%;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  background: #111;
  color: #fff;
  padding: 0 40px 0 12px;
  font-size: 14px;
  outline: none;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.ks-token-search::placeholder {
  color: #8e8e8e;
}

.ks-token-search:focus {
  border-color: rgba(255, 255, 255, 0.18);
  background: #101010;
}

.ks-token-search-icon {
  position: absolute;
  top: 50%;
  right: 12px;
  color: #8e8e8e;
  transform: translateY(-50%);
  pointer-events: none;
}

.ks-token-search-icon svg {
  width: 18px;
  height: 18px;
}

.ks-chain-wrap {
  position: relative;
  min-width: 0;
}

.ks-chain-toggle {
  width: 66px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  background: #111;
  color: #fff;
  padding: 0 8px;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease;
}

.ks-chain-toggle:hover,
.ks-chain-toggle:focus {
  border-color: rgba(255, 255, 255, 0.18);
  background: #151515;
}

.ks-chain-toggle svg {
  width: 14px;
  height: 14px;
}

.ks-chain-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 2;
  min-width: 190px;
  display: block;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: #242424;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.32);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-6px) scale(0.98);
  transform-origin: top right;
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
}

.ks-chain-wrap[data-open="true"] .ks-chain-dropdown {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.ks-chain-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #fff;
  padding: 9px;
  text-align: left;
  cursor: pointer;
}

.ks-chain-option:hover,
.ks-chain-option[data-active="true"] {
  background: rgba(255, 255, 255, 0.06);
}

.ks-chain-icon,
.ks-token-logo,
.ks-token-logo-fallback {
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  border-radius: 999px;
  background: #2a2a2a;
  color: var(--ks-primary, #31cb9e);
  font-weight: 700;
  line-height: 1;
}

.ks-chain-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  font-size: 9px;
}

.ks-chain-icon img,
.ks-token-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ks-token-popular {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: nowrap;
  gap: 7px;
  min-width: 0;
  overflow: hidden;
  padding: 0 20px 12px;
}

.ks-token-pill {
  height: 28px;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: #292929;
  color: #f3f3f3;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, filter 140ms ease;
}

.ks-token-pill .ks-token-logo {
  width: 18px !important;
  height: 18px !important;
  flex-basis: 18px !important;
  font-size: 7px;
}

.ks-token-pill:hover,
.ks-token-pill:focus {
  border-color: rgba(49, 203, 158, 0.35);
  filter: brightness(1.08);
}

.ks-token-pill[disabled] {
  cursor: not-allowed;
  opacity: 0.45;
}

.ks-token-tabs {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  overflow: visible;
  padding: 0 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.ks-token-tab {
  position: relative;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #f0f0f0;
  padding: 5px 0 9px;
  font-size: 14px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
  transition: color 140ms ease;
}

.ks-token-tab::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 1px;
  background: transparent;
}

.ks-token-tab:hover,
.ks-token-tab[data-active="true"] {
  color: var(--ks-primary, #31cb9e);
}

.ks-token-tab[data-active="true"]::after {
  background: var(--ks-primary, #31cb9e);
}

.ks-token-tab-icon,
.ks-token-tab-icon svg {
  width: 14px;
  height: 14px;
}

.ks-token-info-text,
.ks-token-status {
  flex: 0 0 auto;
  padding: 0 20px 9px;
  color: #9b9b9b;
  font-size: 13px;
  line-height: 1.35;
}

.ks-token-info-text:not(:empty) {
  padding-top: 22px;
}

.ks-token-status {
  min-height: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.ks-token-status:not(:empty) {
  padding-top: 7px;
  padding-bottom: 7px;
}

.ks-token-status[data-tone="error"] {
  color: var(--ks-red, #ff537b);
}

.ks-token-table {
  min-height: 230px;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  overflow: hidden;
}

.ks-token-table-header,
.ks-token-row {
  display: grid;
  grid-template-columns: minmax(196px, 1.56fr) minmax(84px, 0.72fr) minmax(74px, 0.62fr) minmax(66px, 0.55fr);
  gap: 8px;
  align-items: center;
}

.ks-token-table-header {
  flex: 0 0 auto;
  padding: 8px 20px 7px;
  color: #868686;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.ks-token-table-header > * {
  min-width: 0;
}

.ks-token-sort {
  max-width: max-content;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: inherit;
  padding: 1px 3px;
  font-size: inherit;
  font-weight: inherit;
  line-height: 1.1;
  text-transform: inherit;
  white-space: nowrap;
  cursor: pointer;
}

.ks-token-sort svg {
  width: 10px;
  height: 10px;
}

.ks-token-sort:hover,
.ks-token-sort[data-active="true"] {
  background: #2a2a2a;
  color: #fff;
}

.ks-token-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0 12px 4px;
}

.ks-token-row {
  width: 100%;
  min-height: 56px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  padding: 6px 8px;
  text-align: left;
  cursor: pointer;
  transition: background-color 140ms ease, filter 140ms ease;
}

.ks-token-row:hover,
.ks-token-row:focus {
  background: rgba(255, 255, 255, 0.045);
}

.ks-token-row[data-same="true"] {
  opacity: 0.54;
}

.ks-token-main-cell {
  min-width: 0;
  display: grid;
  grid-template-columns: 18px 24px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
}

.ks-token-icon-button {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #7d7d7d;
  cursor: pointer;
  transition: color 140ms ease, background-color 140ms ease;
}

.ks-token-icon-button svg {
  width: 14px;
  height: 14px;
  stroke-width: 1.8;
}

.ks-token-symbol-line .ks-token-icon-button,
.ks-token-name-line .ks-token-icon-button {
  width: 14px;
  height: 14px;
}

.ks-token-symbol-line .ks-token-icon-button svg,
.ks-token-name-line .ks-token-icon-button svg {
  width: 13px;
  height: 13px;
}

.ks-token-icon-button:hover,
.ks-token-icon-button:focus,
.ks-token-icon-button[data-active="true"] {
  background: transparent;
  color: var(--ks-primary, #31cb9e);
}

.ks-token-logo {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  font-size: 8px;
}

.ks-token-main-meta {
  min-width: 0;
}

.ks-token-symbol-line {
  display: flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
}

.ks-token-symbol {
  min-width: 0;
  overflow: hidden;
  color: #f1f1f1;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ks-token-badge {
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(255, 153, 1, 0.16);
  color: var(--ks-warning, #ff9901);
  padding: 1px 5px;
  font-size: 9px;
  line-height: 1.2;
}

.ks-token-name-line {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  margin-top: 4px;
}

.ks-token-name,
.ks-token-address,
.ks-token-secondary,
.ks-token-num-secondary {
  min-width: 0;
  overflow: hidden;
  color: #777;
  font-size: 11.5px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ks-token-cell {
  min-width: 0;
  display: block;
}

.ks-token-num,
.ks-token-num-secondary {
  display: block;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ks-token-num {
  color: #f4f4f4;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.2;
}

.ks-token-num-secondary {
  margin-top: 4px;
}

.ks-token-positive {
  color: var(--ks-primary, #31cb9e);
}

.ks-token-negative {
  color: var(--ks-red, #ff537b);
}

.ks-token-neutral {
  color: #9a9a9a;
}

.ks-token-load-more {
  width: calc(100% - 16px);
  min-height: 34px;
  margin: 8px 8px 2px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: #292929;
  color: #fff;
  cursor: pointer;
}

.ks-token-load-more:hover,
.ks-token-load-more:focus {
  filter: brightness(1.08);
}

.ks-token-footer {
  flex: 0 0 auto;
  padding: 9px 20px 13px;
  color: #9b9b9b;
  font-size: 11px;
  font-style: italic;
  line-height: 1.35;
}

@keyframes ksTokenDrop {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 640px) {
  .ks-token-modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .ks-token-modal {
    width: 100%;
    max-height: 92dvh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 20px 20px 0 0;
  }

  .ks-token-modal-header,
  .ks-token-search-row,
  .ks-token-popular,
  .ks-token-tabs,
  .ks-token-info-text,
  .ks-token-status,
  .ks-token-footer {
    padding-right: 14px;
    padding-left: 14px;
  }

  .ks-token-search-row {
    grid-template-columns: minmax(0, 1fr) 62px;
  }

  .ks-chain-toggle {
    width: 62px;
  }

  .ks-token-tabs {
    gap: 7px;
  }

  .ks-token-tab {
    font-size: 12.5px;
  }

  .ks-token-table-header,
  .ks-token-row {
    grid-template-columns: minmax(160px, 1.45fr) minmax(78px, 0.74fr) minmax(72px, 0.62fr);
    gap: 7px;
  }

  .ks-token-table-header > :last-child,
  .ks-token-row > :last-child {
    display: none;
  }

  .ks-token-table-header {
    padding-right: 14px;
    padding-left: 14px;
  }

  .ks-token-list {
    padding-right: 6px;
    padding-left: 6px;
  }
}

@media (max-width: 420px) {
  .ks-token-table-header,
  .ks-token-row {
    grid-template-columns: minmax(145px, 1.25fr) minmax(70px, 0.62fr) minmax(64px, 0.56fr);
    gap: 6px;
  }

  .ks-token-main-cell {
    grid-template-columns: 16px 22px minmax(0, 1fr);
    gap: 6px;
  }

  .ks-token-logo {
    width: 22px;
    height: 22px;
    flex-basis: 22px;
  }

  .ks-token-num {
    font-size: 11.5px;
  }
}
