:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-strong: #eef4f2;
  --text: #14211f;
  --muted: #63706d;
  --line: #d8e0de;
  --accent: #0f766e;
  --accent-dark: #0b5f58;
  --warning: #a75f00;
  --shadow: 0 18px 50px rgba(24, 38, 36, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

button {
  border: 0;
  font: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.68;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

textarea {
  min-height: 90px;
  padding: 10px 12px;
  resize: vertical;
}

label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(30px, 5vw, 54px);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
}

.status-pill {
  min-width: 170px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}

.status-pill.ready {
  border-color: rgba(15, 118, 110, 0.28);
  background: #e5f4ef;
  color: var(--accent-dark);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metrics article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metrics span,
.panel p,
.provider-id,
.wallet-source,
dt,
.empty-state span {
  color: var(--muted);
  font-size: 13px;
}

.metrics strong {
  display: block;
  margin-top: 8px;
  font-size: 25px;
}

.workspace {
  display: grid;
  grid-template-columns: 330px 330px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}

.operations {
  display: grid;
  grid-template-columns: 420px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}

.swap-area {
  display: grid;
  grid-template-columns: 420px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}

.smart-account-area {
  display: grid;
  grid-template-columns: 420px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.tron-area {
  display: grid;
  grid-template-columns: 420px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  margin-top: 18px;
  margin-bottom: 18px;
}

.tron-control-panel,
.tron-portfolio-panel {
  border-top: 4px solid #d71920;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.panel-heading p {
  margin-top: 4px;
}

.duration-control {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.walletconnect-form {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.walletconnect-form label {
  display: grid;
  gap: 6px;
}

.qr-panel {
  display: grid;
  place-items: center;
  min-height: 290px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfc;
  color: var(--muted);
  text-align: center;
}

.qr-panel canvas {
  max-width: 100%;
  height: auto !important;
}

.qr-panel img {
  max-width: 100%;
  height: auto;
}

.walletconnect-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--accent-dark);
  font-weight: 800;
  text-decoration: none;
}

.connection-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.connection-summary div {
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-strong);
}

.connection-summary span,
.provider-capability {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.connection-summary strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

.authorization-preview {
  margin: -4px 0 14px;
  border-radius: 8px;
  padding: 10px;
  background: #f8fbfb;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.provider-help {
  display: none;
  margin-bottom: 14px;
  border: 1px solid rgba(167, 95, 0, 0.28);
  border-radius: 8px;
  padding: 10px;
  background: #fff7e8;
  color: #5b3a08;
  font-size: 13px;
  line-height: 1.45;
}

.provider-help:not(:empty) {
  display: block;
}

.provider-list,
.wallet-grid,
.list-block {
  display: grid;
  gap: 10px;
}

.provider-card,
.wallet-card,
.list-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.provider-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
}

.provider-card.connected {
  border-color: rgba(15, 118, 110, 0.36);
  background: #e5f4ef;
}

.provider-card.connected .provider-capability {
  color: var(--accent-dark);
}

.provider-actions {
  display: grid;
  justify-items: end;
  gap: 6px;
  flex: 0 0 auto;
}

.provider-identity,
.wallet-top,
.list-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.provider-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
  background: #dfe8e6;
}

.provider-name,
.provider-id,
.wallet-address,
.whitelist-address,
.queue-details,
.router-details {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.provider-id {
  max-width: 190px;
}

.primary-button,
.secondary-button,
.icon-button {
  min-height: 40px;
  border-radius: 8px;
  font-weight: 800;
}

.primary-button {
  padding: 0 14px;
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.secondary-button {
  border: 1px solid var(--line);
  padding: 0 14px;
  background: #fff;
  color: var(--text);
}

.icon-button {
  width: 40px;
  flex: 0 0 40px;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
  font-size: 20px;
}

.wallet-card {
  padding: 14px;
}

.wallet-top {
  justify-content: space-between;
  align-items: flex-start;
}

.wallet-top > div {
  min-width: 0;
}

.wallet-address {
  margin-top: 5px;
  font-size: 17px;
}

.wallet-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 0;
}

.wallet-details div {
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.chain-balance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.chain-balance {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  min-width: 0;
}

.network-portfolio {
  min-height: 150px;
}

.bnb-network {
  border-top: 4px solid #f0b90b;
  background: #fffdf4;
}

.ethereum-network {
  border-top: 4px solid #627eea;
  background: #f7f9ff;
}

.tron-network {
  border-top: 4px solid #d71920;
  background: #fff8f8;
}

.network-address {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chain-balance.active-chain {
  border-color: rgba(15, 118, 110, 0.38);
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.14);
}

.chain-balance span,
.chain-balance strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chain-balance span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.chain-balance .network-title {
  color: var(--text);
  font-size: 14px;
}

.chain-balance strong {
  margin-top: 4px;
  font-size: 13px;
}

.token-balance-list {
  display: grid;
  gap: 3px;
  margin-top: 7px;
  border-top: 1px solid var(--line);
  padding-top: 7px;
}

.token-balance-list span {
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.token-balance-list .token-list-heading {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.token-balance-list > small {
  color: var(--muted);
  font-size: 12px;
}

.token-balance-list .indexer-warning {
  margin-bottom: 4px;
  color: var(--warning);
  line-height: 1.35;
  white-space: normal;
}

.token-balance-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 8px;
}

.token-balance-row small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.spam-badge {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  padding: 3px 7px;
  background: #fff0d2;
  color: #7a4300 !important;
  font-size: 11px;
  font-weight: 900;
}

.tron-form {
  display: grid;
  gap: 12px;
}

.tron-form label {
  display: grid;
  gap: 6px;
}

.tron-token-row > div {
  display: grid;
  gap: 5px;
}

.token-contract {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.wallet-select {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  margin-top: 12px;
  color: var(--text);
}

.wallet-checkbox {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.wallet-checkbox:disabled {
  cursor: not-allowed;
}

.session-badge {
  flex: 0 0 auto;
  max-width: 190px;
  border-radius: 999px;
  padding: 6px 10px;
  background: #fff7e8;
  color: var(--warning);
  font-size: 12px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-badge.active {
  background: #e5f4ef;
  color: var(--accent-dark);
}

.wallet-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.stack-form,
.transfer-form,
.router-form,
.swap-form,
.smart-form {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.transfer-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
}

.transfer-form .primary-button {
  min-width: 130px;
}

.router-form {
  grid-template-columns: minmax(0, 1fr) minmax(120px, 0.7fr);
}

.router-form label:last-of-type {
  grid-column: 1 / -1;
}

.router-form .primary-button {
  grid-column: 1 / -1;
}

.swap-form {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(120px, 0.6fr) minmax(120px, 0.7fr) minmax(120px, 0.7fr) auto;
  align-items: end;
}

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

.smart-form label:first-child,
.smart-form label:last-of-type,
.smart-form .primary-button,
.scope-box {
  grid-column: 1 / -1;
}

.stack-form label,
.transfer-form label,
.router-form label,
.swap-form label,
.smart-form label {
  display: grid;
  gap: 6px;
}

.scope-box {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.scope-box legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.scope-box label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.scope-box input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.hidden {
  display: none !important;
}

.list-row {
  justify-content: space-between;
  padding: 12px;
}

.list-row > div {
  min-width: 0;
}

.whitelist-address,
.queue-details,
.router-details {
  max-width: 100%;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.policy-call {
  display: block;
  max-width: 100%;
  margin-top: 8px;
  border-radius: 8px;
  padding: 8px;
  background: #fff;
  color: #31413e;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.execution-mode {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
  border: 1px solid rgba(167, 95, 0, 0.28);
  border-radius: 8px;
  padding: 12px;
  background: #fff7e8;
  color: #3a3020;
}

.execution-mode span {
  color: #5b3a08;
  font-size: 13px;
  line-height: 1.45;
}

.fee-estimate {
  margin: -4px 0 12px;
  border-radius: 8px;
  padding: 10px;
  background: #f8fbfb;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.queue-status {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 6px 10px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.queue-status.success {
  background: #e5f4ef;
  color: var(--accent-dark);
}

.queue-status.pending {
  background: #ecf2ff;
  color: #2456a6;
}

.queue-status.warning {
  background: #fff7e8;
  color: var(--warning);
}

dt {
  margin-bottom: 4px;
}

dd {
  margin: 0;
  font-weight: 800;
}

.empty-state {
  display: grid;
  gap: 5px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 28px;
  text-align: center;
  background: #fbfcfc;
}

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

.notice {
  margin-top: 18px;
  border: 1px solid rgba(167, 95, 0, 0.28);
  border-radius: 8px;
  padding: 14px 16px;
  background: #fff7e8;
  color: #3a3020;
  line-height: 1.5;
}

@media (max-width: 840px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .status-pill {
    width: 100%;
  }

  .metrics,
  .workspace,
  .operations,
  .swap-area,
  .smart-account-area,
  .tron-area,
  .transfer-form,
  .router-form,
  .swap-form,
  .smart-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding: 18px 0;
  }

  .provider-card,
  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .provider-id {
    max-width: 100%;
  }

.provider-card .primary-button,
  .secondary-button,
  .transfer-form .primary-button,
  .router-form .primary-button,
  .swap-form .primary-button,
  .smart-form .primary-button {
    width: 100%;
  }

  .provider-actions {
    justify-items: stretch;
  }

  .wallet-details {
    grid-template-columns: 1fr;
  }

  .chain-balance-grid {
    grid-template-columns: 1fr;
  }

  .list-row {
    align-items: stretch;
    flex-direction: column;
  }

  .list-row .icon-button {
    width: 100%;
  }

  .queue-actions {
    flex-direction: column;
  }

  .wallet-top {
    align-items: stretch;
    flex-direction: column;
  }

  .session-badge {
    max-width: 100%;
  }

  .wallet-actions {
    flex-direction: column;
  }
}
