:root {
  color-scheme: dark;
  --bg: #050705;
  --panel: #0b100d;
  --panel-2: #101812;
  --line: #27332a;
  --text: #eef6f0;
  --muted: #8f9f94;
  --primary: #45c983;
  --primary-hover: #61de98;
  --green: #45c983;
  --link: #9cf2b9;
  --link-hover: #f4fff7;
  --active-row: #173c27;
  --active-row-border: #71ef9f;
  --slot-row: #253229;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  color: var(--link-hover);
}

button,
input {
  font: inherit;
}

.app-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  padding: 20px 20px 0;
}

@supports (height: 100dvh) {
  .app-shell {
    height: 100dvh;
    min-height: 100dvh;
  }
}

.app-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 46px;
  margin-bottom: 0;
  padding-bottom: 10px;
}

.app-header h1 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  font-size: 18px;
  line-height: 1.5;
  font-weight: 700;
  text-align: left;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: 6px;
  overflow: hidden;
}

.brand-mark .svg-icon {
  width: 24px;
  height: 24px;
}

.link-row {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  justify-content: flex-end;
  gap: 0;
  min-width: 0;
  padding-top: 0;
  font-size: 0;
  white-space: nowrap;
}

.link-row a {
  display: inline-grid;
  align-items: center;
  justify-items: center;
  place-items: center;
  width: 40px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.link-row a:hover {
  color: var(--primary);
  background: #101812;
}

.external-link-twitter::before {
  content: "X";
  font-size: 13px;
}

.external-link-telegram::before {
  content: "↗";
  font-size: 18px;
}

.external-link-akbot::before {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  border: 1px solid currentColor;
  background:
    linear-gradient(135deg, transparent 55%, currentColor 56% 62%, transparent 63%),
    var(--bg);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.control-band {
  position: relative;
  z-index: 5;
  padding: 0;
  background: transparent;
  backdrop-filter: none;
  text-align: left;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  align-items: flex-start;
  justify-content: flex-start;
  min-height: 47px;
  margin-bottom: 0;
  padding-top: 2px;
}

.tool-button,
.search-button {
  min-height: 34px;
  border: 1px solid rgba(238, 246, 240, 0.72);
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  padding: 0 14px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 400;
}

.tool-button:hover,
.search-button:hover {
  border-color: var(--primary);
  background: var(--panel-2);
  color: #ffffff;
}

.tool-button.is-active,
.search-button {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.search-button {
  min-width: 56px;
}

.tool-button[data-filter="all"] {
  border-radius: 6px 0 0 6px;
}

.tool-button[data-filter="success"] {
  border-left: 0;
  border-radius: 0;
}

.tool-button[data-filter="remark"] {
  border-left: 0;
  border-radius: 0 6px 6px 0;
}

.language-toggle {
  display: inline-grid;
  place-items: center;
  width: 40px;
  min-width: 40px;
  margin-left: 10px;
  padding: 0;
  border-radius: 6px;
}

.language-toggle::before {
  content: attr(data-glyph);
  font-size: 13px;
  line-height: 1;
}

#columnsToggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: 10px;
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
  border-radius: 6px;
}

#columnsToggle::before {
  content: "▥";
  display: inline-block;
  font-size: 12px;
  line-height: 1;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  width: min(100%, 700px);
  max-width: none;
  margin: 0;
}

.search-row input {
  width: 100%;
  min-height: 34px;
  border: 1px solid #2d3a31;
  border-radius: 5px;
  background: #111611;
  color: var(--text);
  padding: 0 13px;
  outline: none;
  font-size: 14px;
}

.search-row input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(69, 201, 131, 0.18);
}

.status-row {
  display: none;
  min-height: 0;
  margin-top: 8px;
  color: var(--muted);
  text-align: left;
  font-size: 13px;
}

.status-row.is-visible {
  display: block;
  min-height: 20px;
}

.column-panel {
  position: absolute;
  left: 350px;
  top: 44px;
  transform: none;
  width: min(320px, calc(100vw - 48px));
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b100d;
  padding: 10px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.column-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  color: var(--text);
  font-size: 13px;
}

.column-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.table-shell {
  position: relative;
  isolation: isolate;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  margin-top: 10px;
  overflow: auto;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-left: 1px solid var(--line);
  border-radius: 6px;
}

.table-scroll-spacer {
  display: block;
  width: 1px;
  height: 0;
  pointer-events: none;
}

.tx-table {
  width: 100%;
  min-width: 1515px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13px;
}

.tx-table thead {
  display: table-header-group;
}

.tx-table tbody {
  display: table-row-group;
}

.tx-table th,
.tx-table td {
  border-bottom: 1px solid var(--line);
  padding: 9px 7px;
  text-align: left;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: normal;
  white-space: nowrap;
  line-height: 1.25;
}

.tx-table th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #131913;
  color: #e8f2eb;
  font-weight: 600;
}

.tx-table td {
  background: #0d110e;
  color: #e1e9e3;
  padding: 11px 7px;
}

.tx-table td a {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  min-width: 0;
  vertical-align: middle;
}

.cell-actions > a:not(.cell-icon-button) {
  flex: 1 1 auto;
  min-width: 0;
}

.cell-icon-button {
  position: relative;
  display: inline-grid !important;
  place-items: center;
  width: 18px;
  height: 18px;
  min-width: 18px;
  flex: 0 0 18px;
  border: 0;
  border-radius: 4px;
  padding: 0;
  background: transparent;
  color: #dbe6de;
  cursor: pointer;
  line-height: 1;
}

.svg-icon {
  display: block;
  width: 15px;
  height: 15px;
  pointer-events: none;
  stroke-width: 2;
}

.icon-solscan .svg-icon {
  width: 18px;
  height: 18px;
}

button.cell-icon-button {
  appearance: none;
  font: inherit;
}

.cell-icon-button:hover {
  color: var(--primary);
  background: rgba(67, 199, 131, 0.08);
}

.icon-solscan {
  width: 18px;
  height: 18px;
}

.address-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
}

.address-cell > .cell-actions {
  flex: 1 1 auto;
}

.remark-pill {
  display: inline-block;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: auto;
  border: 1px solid rgba(76, 201, 132, 0.24);
  border-radius: 4px;
  background: rgba(76, 201, 132, 0.1);
  color: #b6f7ce;
  padding: 2px 5px;
  font-size: 12px;
  line-height: 1.25;
}

.clipboard-fallback {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.tx-table tr:hover td {
  background: #141b16;
}

.tx-table tr.is-last-in-slot td {
  box-shadow: inset 0 -1px 0 #59665d;
}

.tx-table tr.slot-leader-row td {
  padding: 0;
  background: #101812;
  color: #e8f2eb;
  box-shadow: inset 3px 0 0 var(--primary), inset 0 -1px 0 rgba(111, 174, 130, 0.34);
  white-space: normal;
}

.tx-table tr.slot-leader-row:hover td {
  background: #101812;
}

.slot-leader-content {
  display: flex;
  align-items: center;
  min-height: 34px;
  gap: 6px;
  padding: 5px 10px;
  overflow: hidden;
  white-space: nowrap;
}

.slot-leader-slot,
.slot-leader-name,
.slot-leader-field {
  flex: 0 0 auto;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slot-leader-slot {
  border: 1px solid rgba(103, 234, 153, 0.42);
  border-radius: 3px;
  color: #b9f8cd;
  padding: 2px 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
}

.slot-leader-name {
  color: #ffffff;
  font-weight: 700;
}

.slot-leader-field {
  color: #b6c6ba;
  font-size: 12px;
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
}

.slot-leader-field.is-client {
  flex: 0 1 138px;
  color: #80e6a2;
}

.slot-leader-field.is-ip {
  flex: 1 1 210px;
  color: #d6e0d8;
}

.slot-leader-row.is-unavailable .slot-leader-name,
.slot-leader-field.is-unavailable {
  color: #9da89f;
}

.slot-leader-field.is-identity,
.slot-leader-field.is-tpu {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #a6ddb7;
}

.slot-leader-field.is-identity {
  flex: 1.55 1 300px;
  max-width: 470px;
}

.slot-leader-field.is-tpu {
  flex: 1.2 1 245px;
  max-width: 460px;
}

.slot-leader-prefix {
  flex: 0 0 auto;
  color: #78d99a;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.slot-leader-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slot-leader-detail {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #94aa9a;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 11px;
}

.slot-leader-detail::before {
  content: "\00b7";
  margin-right: 5px;
  color: #52725b;
}

.slot-leader-field.is-ip .slot-leader-value,
.slot-leader-field.is-tpu .slot-leader-value,
.slot-leader-field.is-identity .slot-leader-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.tx-table tr.is-active td {
  background: var(--active-row);
  color: #ffffff;
  box-shadow:
    inset 0 2px 0 var(--active-row-border),
    inset 0 -2px 0 var(--active-row-border);
}

.tx-table tr.is-active td:first-child {
  box-shadow:
    inset 4px 0 0 var(--active-row-border),
    inset 0 2px 0 var(--active-row-border),
    inset 0 -2px 0 var(--active-row-border);
}

.tx-table tr.is-success td {
  color: var(--green);
}

.tx-table tr.is-success .cell-icon-button {
  color: var(--green);
}

.tx-table tr.is-failed td {
  color: #e1e9e3;
}

.empty-state {
  position: sticky;
  left: 0;
  display: grid;
  min-height: 0;
  width: 100%;
  place-items: center;
  border-top: 1px solid var(--line);
  background: var(--bg);
  color: var(--muted);
  line-height: 1.4;
}

.empty-state[hidden] {
  display: none;
}

.empty-state::before {
  content: "";
  display: none;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.status-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.status-icon {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  border-radius: 999px;
  color: #ffffff;
  line-height: 1;
}

.status-icon svg {
  width: 11px;
  height: 11px;
  stroke-width: 2.4;
}

.status-icon.is-success {
  background: var(--green);
}

.status-icon.is-failed {
  border: 1px solid #7e8d83;
  background: transparent;
  color: #e8f2eb;
}

.cell-stack {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.header-inline,
.cell-inline {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  column-gap: 7px;
  width: 100%;
}

.header-inline span,
.inline-value {
  min-width: 0;
  overflow: hidden;
  overflow-wrap: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.tx-table td[data-column='slot'],
.tx-table td[data-column='index'],
.tx-table td[data-column='amount'],
.tx-table td[data-column='price'],
.tx-table td[data-column='cuGroup'],
.tx-table td[data-column='feeGroup'] {
  font-variant-numeric: tabular-nums;
  text-overflow: clip;
}

.stack-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.stack-label {
  flex: 0 0 auto;
  color: var(--muted);
}

.stack-value {
  min-width: 0;
  color: var(--text);
  overflow: hidden;
  overflow-wrap: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tone-buy {
  color: var(--primary) !important;
  font-weight: 700;
}

.tone-sell {
  color: var(--text) !important;
  font-weight: 700;
}

.tone-link {
  color: var(--link);
}

.remark-dialog {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.62);
}

.remark-dialog[hidden] {
  display: none;
}

.remark-panel {
  width: min(640px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #171d18;
  padding: 24px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.remark-panel h2 {
  margin: 0 0 20px;
  font-size: 22px;
  line-height: 1.25;
}

.remark-field {
  display: grid;
  gap: 8px;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 14px;
}

.remark-field input,
.remark-field textarea {
  width: 100%;
  border: 1px solid #2d3a31;
  border-radius: 8px;
  background: #0d110e;
  color: var(--text);
  padding: 12px;
  outline: none;
}

.remark-field textarea {
  min-height: 104px;
  resize: vertical;
}

.remark-field input[readonly] {
  color: var(--text);
}

.remark-field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(76, 201, 132, 0.2);
}

.remark-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.remark-button {
  min-width: 74px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.remark-save {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.remark-button:disabled {
  cursor: wait;
  opacity: 0.66;
}

@media (max-width: 820px) {
  .app-shell {
    padding: 10px 10px 0;
  }

  .app-header {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 12px;
    min-height: 0;
  }

  .app-header h1 {
    justify-self: start;
    font-size: 18px;
  }

  .link-row {
    position: static;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 12px;
    padding-top: 0;
    font-size: 14px;
  }

  .button-row {
    gap: 8px;
  }

  .tool-button,
  .search-button {
    min-height: 34px;
    padding: 0 12px;
    font-size: 14px;
  }

  .search-row {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 100%;
  }

  .search-row input {
    min-height: 34px;
    font-size: 14px;
  }

  .status-row {
    font-size: 14px;
  }

  .column-panel {
    left: 0;
    top: 44px;
    transform: none;
  }

  .table-shell {
    margin-top: 10px;
  }
}
