:root {
  color-scheme: light;
  --bg: #e6eeea;
  --paper: #fffdf8;
  --ink: #1b2623;
  --muted: #5f6d67;
  --line: #d5e0da;
  --accent: #0e7c72;
  --accent-ink: #f3fbf8;
  --gold: #b86e1a;
  --good: #0e7a4b;
  --bad: #c24b42;
  --sand: #fff1dc;
  --shadow: 0 12px 40px rgba(18, 48, 40, 0.08);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "PingFang SC", "Noto Sans SC", "Source Han Sans SC", sans-serif;
  background:
    radial-gradient(880px 420px at 0% -8%, #c9ebe3 0%, transparent 58%),
    radial-gradient(720px 380px at 100% 0%, #f6ddb4 0%, transparent 52%),
    var(--bg);
  color: var(--ink);
  line-height: 1.55;
}
button, input, select { font: inherit; color: inherit; }
button {
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  border-radius: 999px;
  padding: 0.55rem 1.05rem;
  cursor: pointer;
}
button:hover { filter: brightness(1.05); }
button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
button.danger {
  background: transparent;
  color: var(--bad);
  border: 1px solid transparent;
}
h1, h2 { font-weight: 560; letter-spacing: -0.02em; margin: 0; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.12rem; }
p { margin: 0.35rem 0; }
.mark {
  margin: 0;
  color: var(--gold);
  letter-spacing: 0.22em;
  font-size: 0.72rem;
}
.lede, .muted { color: var(--muted); }
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.login-card {
  width: min(420px, 100%);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 2rem 1.8rem 1.6rem;
}
.login-card h1 { margin: 0.35rem 0 0.6rem; }
.login-card button { margin-top: 0.4rem; }
label { display: grid; gap: 0.35rem; margin: 0.85rem 0; color: var(--muted); font-size: 0.86rem; }
input, select, textarea {
  background: #faf7f2;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
  color: var(--ink);
}
textarea { min-height: 6rem; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(14, 124, 114, 0.28);
  border-color: var(--accent);
}
.shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}
.side {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 1.4rem 1rem 1.1rem;
  border-right: 1px solid #0f2c28;
  background: linear-gradient(180deg, #1a4a42 0%, #14332e 100%);
  color: #f4faf7;
}
.brand { padding: 0.2rem 0.7rem 1.1rem; }
.brand strong { display: block; font-size: 1.15rem; margin-top: 0.15rem; }
.net-switch {
  display: grid;
  gap: 0.35rem;
  margin: 0 0.35rem 0.85rem;
  color: #c5ddd6;
  font-size: 0.86rem;
}
.net-switch select {
  width: 100%;
  background: rgba(255, 248, 236, 0.12);
  color: #fff8ee;
  border-color: rgba(232, 246, 241, 0.28);
}
.net-switch select option { color: var(--ink); background: var(--paper); }
.net-switch select:disabled { opacity: 0.7; }
#network-error { margin: 0; }
nav { display: grid; gap: 0.2rem; }
nav button {
  background: transparent;
  color: #c5ddd6;
  border-radius: 12px;
  text-align: left;
  padding: 0.55rem 0.75rem;
}
nav button.active {
  background: rgba(255, 248, 236, 0.14);
  color: #fff8ee;
  box-shadow: inset 3px 0 0 var(--gold);
}
.side-foot {
  margin-top: auto;
  display: grid;
  gap: 0.55rem;
  padding: 1rem 0.7rem 0;
}
.side-foot strong { font-weight: 560; color: #f7fbf9; }
.side .mark { color: #f0c36a; }
.side .brand strong { color: #f7fbf9; }
.side button.ghost {
  color: #e7f6f1;
  border-color: rgba(232, 246, 241, 0.28);
}
.side .pill { background: rgba(255, 248, 236, 0.12); color: #f3e2c0; }
.side .pill.on { background: rgba(168, 232, 196, 0.2); color: #b7f0cf; }
main {
  padding: 2rem 2.2rem 3rem;
  display: grid;
  align-content: start;
  gap: 1rem;
  width: 100%;
  min-width: 0;
}
.page-head { margin-bottom: 0.2rem; }
.card, pre {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.card { padding: 1.15rem 1.2rem 1.2rem; }
.card h2 { margin-bottom: 0.35rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0.9rem; }
.market-board { display: grid; gap: 0.9rem; }
.page-head .actions { margin-top: 0.7rem; }
.pool-top {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(8rem, 0.7fr) minmax(8rem, 0.7fr);
  gap: 0.75rem 1.2rem;
  align-items: end;
}
.pool-metric { margin: 0; }
.pool-metric span, .pool-metric em {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-style: normal;
}
.pool-metric strong {
  display: block;
  margin: 0.1rem 0;
  font-size: 1.45rem;
  font-weight: 560;
  letter-spacing: -0.03em;
  color: var(--accent);
}
.pool-card .sub { display: block; color: var(--muted); font-size: 0.8rem; }
.pool-card .trade-table { margin-top: 0.85rem; }
button.ghost.active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
}
.scan-sub { margin-top: 1.1rem; }
.scan-list { list-style: none; margin: 0.4rem 0 0; padding: 0; }
.scan-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
  align-items: end;
  padding: 0.7rem 0.05rem;
  border-bottom: 1px solid var(--line);
}
.scan-list li:last-child { border-bottom: 0; }
.scan-list .sub { display: block; color: var(--muted); font-size: 0.8rem; }
.trade-alert {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: end;
  margin: 0;
}
.trade-alert label { margin: 0; min-width: 14rem; }
.pool-id, .id, .mono, pre, code {
  font-family: "IBM Plex Mono", "Source Code Pro", ui-monospace, monospace;
  font-size: 0.78rem;
}
.pool-id, .id {
  color: var(--muted);
  white-space: nowrap;
}
.stat { font-size: 1.85rem; letter-spacing: -0.03em; margin: 0.4rem 0 0.2rem; color: var(--accent); }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 0.45rem 1rem; margin-top: 0.7rem; }
.facts span { display: block; color: var(--muted); font-size: 0.78rem; }
.note, .missing {
  background: var(--sand);
  border-radius: 14px;
  padding: 0.75rem 0.95rem;
  color: #6d4e22;
}
.missing { border: 0; }
.strategy-list { padding: 0.35rem 1rem 0.55rem; }
.strategy-head, .strategy-row {
  display: grid;
  grid-template-columns: minmax(12rem, 16rem) max-content minmax(14rem, 1fr) minmax(8.5rem, 12rem) auto;
  gap: 0.75rem 1.25rem;
  align-items: center;
  padding: 0.72rem 0.1rem;
  border-bottom: 1px solid var(--line);
}
.strategy-head { color: var(--muted); font-size: 0.78rem; }
.strategy-row:last-child { border-bottom: 0; }
.strategy-list .sub { display: block; margin-top: 0.18rem; color: var(--muted); font-size: 0.8rem; }
.strategy-list .sub.error { color: var(--bad); }
.strategy-list .actions { margin-top: 0; flex-wrap: wrap; justify-content: flex-end; }
.log-head { display: flex; justify-content: space-between; align-items: center; gap: 0.8rem; }
.log-head h2 { margin: 0; }
.log-head .actions { margin-top: 0; }
.log-pager { display: flex; align-items: center; gap: 0.7rem; margin-top: 0.8rem; }
.log-pager span { color: var(--muted); font-size: 0.85rem; }
.key-search { margin: 0.7rem 0 0.15rem; }
.key-list { list-style: none; margin: 0.35rem 0 0; padding: 0; }
.key-list li {
  font-family: "IBM Plex Mono", "Source Code Pro", ui-monospace, monospace;
  font-size: 0.82rem;
  padding: 0.45rem 0.05rem;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.key-list li.key-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}
.key-row .key-address {
  flex: 1 1 16rem;
  min-width: 0;
  font-family: "IBM Plex Mono", "Source Code Pro", ui-monospace, monospace;
}
.key-note {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  color: var(--ink);
  font-family: "Avenir Next", "PingFang SC", "Noto Sans SC", "Source Han Sans SC", sans-serif;
  font-size: 0.92rem;
}
.key-note .wallet-label { width: 8.5rem; }
.key-list li:last-child { border-bottom: 0; }
.group-list { list-style: none; margin: 0.2rem 0 0; padding: 0; }
.group-list li + li { border-top: 1px solid var(--line); }
.group-list button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  background: transparent;
  color: var(--ink);
  border: 0;
  border-radius: 0;
  padding: 0.8rem 0.1rem;
  text-align: left;
  box-shadow: none;
}
.group-list button span:first-child { display: grid; gap: 0.12rem; min-width: 0; }
.group-list button small { color: var(--muted); font-size: 0.78rem; }
.group-list button span:last-child { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
button:disabled { opacity: 0.45; }
.log-table { overflow-x: auto; }
.log-table td.network { white-space: nowrap; }
.log-table button { padding: 0.28rem 0.7rem; }
.log-table input[type="checkbox"],
.wallet-table input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
  vertical-align: middle;
}
.wallet-table th, .wallet-table td { vertical-align: middle; }
.wallet-table button { padding: 0.28rem 0.7rem; white-space: nowrap; }
.user-table button { padding: 0.28rem 0.7rem; white-space: nowrap; }
.user-table td, .user-table th { vertical-align: middle; }
.wallet-note { display: flex; align-items: center; gap: 0.45rem; }
.wallet-note .wallet-label {
  width: 11rem;
  max-width: 100%;
  margin: 0;
  padding: 0.38rem 0.6rem;
  border-radius: 10px;
}
.wallet-label-state { color: var(--good); font-size: 0.78rem; white-space: nowrap; }
.wallet-label-state.bad { color: var(--bad); white-space: normal; }
.wallet-tools { margin: 0.15rem 0 0.55rem; }
#wallet-confirm-text { white-space: pre-line; max-height: 16rem; overflow: auto; }
.hash-line { display: inline-flex; align-items: center; gap: 0.35rem; }
.hash-line code { font-size: 0.82rem; }
.log-table button.linkish {
  background: none;
  color: var(--accent);
  padding: 0;
  border-radius: 0;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}
dialog.payees { max-width: min(40rem, calc(100vw - 2rem)); }
.payee-list {
  list-style: none;
  margin: 0.2rem 0 1rem;
  padding: 0;
  max-height: 18rem;
  overflow: auto;
  display: grid;
  gap: 0.45rem;
}
.payee-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  overflow-wrap: anywhere;
}
.payee-list code { font-size: 0.82rem; }
.payee-list span { color: var(--muted); white-space: nowrap; }
dialog {
  border: 0;
  border-radius: 18px;
  padding: 1.2rem 1.3rem;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
  max-width: 28rem;
}
dialog[open] {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  z-index: 30;
}
dialog::backdrop { background: rgba(18, 48, 40, 0.35); }
dialog p { overflow-wrap: anywhere; }
.broadcast-network { margin: 0.85rem 0 0.35rem; font-size: 1.05rem; }
.broadcast-network strong {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.14rem 0.7rem;
  border-radius: 999px;
  background: #e7f3fb;
  color: #245b86;
}
.broadcast-network strong[data-network="mainnet"] { background: #fff1dc; color: #8a5a16; }
.strategy-list button { padding: 0.32rem 0.72rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.78rem;
}
th, td { text-align: left; padding: 0.62rem 0.35rem; vertical-align: top; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
.pill {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  padding: 0.18rem 0.6rem;
  background: #fff1dc;
  color: #8a5a16;
  font-size: 0.78rem;
}
.pill.on { background: #e3f6ea; color: var(--good); }
.chip {
  display: inline-flex;
  border-radius: 999px;
  padding: 0.12rem 0.55rem;
  background: #e7f3fb;
  color: #245b86;
  font-size: 0.78rem;
}
.chip.run { background: #e3f6ea; color: var(--good); }
.error { color: var(--bad); min-height: 1.2em; }
.row, .actions { display: flex; gap: 0.55rem; flex-wrap: wrap; align-items: end; }
.row label { margin: 0; flex: 1; min-width: 150px; }
#collect-form .row > label.address {
  flex: 1 1 18rem;
  min-width: min(100%, 14rem);
  max-width: min(100%, 24rem);
}
#distribute-form { min-width: 0; max-width: 100%; }
#distribute-form .row:not(.distribute-target) {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  align-items: end;
}
#distribute-form .row > label,
#distribute-form .row > label.address,
#distribute-amount-mode {
  flex: none;
  min-width: 0;
  max-width: none;
  margin: 0;
}
#ft-contract-field,
#collect-ft-field,
#distribute-batch { max-width: 100%; }
.combo { position: relative; }
button.combo-toggle {
  width: 100%;
  text-align: left;
  background: #faf7f2;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.65rem 2rem 0.65rem 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
}
button.combo-toggle.placeholder { color: var(--muted); }
button.combo-toggle::after {
  content: "";
  position: absolute;
  right: 0.85rem;
  top: 50%;
  width: 0.42rem;
  height: 0.42rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
}
.combo-panel {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  top: calc(100% + 0.35rem);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 0.45rem;
}
.combo-query { width: 100%; }
.combo-list {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  max-height: 16rem;
  overflow: auto;
}
button.combo-option {
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--ink);
  border-radius: 8px;
  padding: 0.4rem 0.55rem;
  font-family: "IBM Plex Mono", "Source Code Pro", ui-monospace, monospace;
  font-size: 0.78rem;
  white-space: normal;
  overflow-wrap: anywhere;
}
button.combo-option.active,
button.combo-option:hover { background: #e7f3ef; }
.combo-empty { margin: 0.35rem 0.2rem 0.15rem; }
#distribute-form input,
#distribute-form select,
#distribute-form textarea,
#collect-form input,
#collect-form select,
#collect-form textarea,
#split-form input,
#split-form select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}
#distribute-targets { display: grid; gap: 0.7rem; margin-top: 0.85rem; min-width: 0; }
.distribute-target {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 0.55rem;
  align-items: end;
  min-width: 0;
}
#distribute-form .distribute-target label,
#distribute-form .distribute-target label.address {
  min-width: 0;
  margin: 0;
  flex: none;
}
#distribute-form.amount-equal .distribute-target {
  grid-template-columns: minmax(0, 1fr) auto;
}
#distribute-form.amount-equal .target-amount { display: none; }
#distribute-equal { max-width: 100%; min-width: 0; }
#distribute-equal label { max-width: none; }
#distribute-hint,
#distribute-batch { max-width: 100%; overflow-wrap: anywhere; }
.draft-save { margin-top: 0.35rem; }
.draft-save label { margin: 0; flex: 1 1 16rem; }
#distribute-draft-state { min-height: 1.2em; }
.draft-list { list-style: none; margin: 0.35rem 0 0; padding: 0; }
.draft-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-top: 1px solid var(--line);
}
.draft-row .sub { display: block; margin-top: 0.12rem; color: var(--muted); font-size: 0.8rem; }
.draft-row .actions { margin-top: 0; flex: none; }
.draft-row.current strong { color: var(--accent); }
#strategy-form .row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem 1.35rem;
}
#strategy-form .row label { min-width: 0; }
#strategy-form .wide { grid-column: 1 / -1; }
.page-head { display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; align-items: baseline; }
.page-head p { flex: 1; min-width: 12rem; }
#strategy-form input,
#strategy-form select,
#strategy-form textarea {
  width: 100%;
  padding: 0.72rem 0.9rem;
}
#strategy-form button.combo-toggle {
  padding: 0.72rem 2rem 0.72rem 0.9rem;
}
#mcap-fields label:first-child { grid-column: 1 / -1; }
.actions { margin-top: 0.8rem; }
pre {
  white-space: pre-wrap;
  padding: 0.9rem 1rem;
  overflow: auto;
  color: #4e4943;
  box-shadow: none;
}
ul { margin: 0.4rem 0 0; padding-left: 1.1rem; }
li { margin: 0.28rem 0; }
@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .side {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding-bottom: 0.8rem;
  }
  nav { grid-auto-flow: column; grid-auto-columns: max-content; grid-template-columns: none; overflow-x: auto; }
  .pool-top { grid-template-columns: 1fr; }
  .side-foot {
    margin-top: 0.8rem;
    grid-template-columns: auto 1fr auto;
    align-items: center;
  }
  .side-foot .pill { justify-self: start; }
  .side-foot button { justify-self: end; width: auto; }
  main { padding: 1.1rem 1rem 2.4rem; }
  .facts { grid-template-columns: 1fr; }
  table { display: block; overflow-x: auto; }
  .strategy-head { display: none; }
  .strategy-row { grid-template-columns: 1fr auto; }
  .strategy-row .actions { grid-column: 1 / -1; }
  #strategy-form .row { grid-template-columns: 1fr; }
  #distribute-form .row:not(.distribute-target),
  .distribute-target,
  #distribute-form.amount-equal .distribute-target {
    grid-auto-flow: row;
    grid-template-columns: minmax(0, 1fr);
  }
  .draft-row { align-items: flex-start; flex-direction: column; }
}
