:root {
  color-scheme: dark;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: #0b1020;
  color: #e9edf8
}

* {
  box-sizing: border-box
}

body {
  margin: 0
}

.shell {
  max-width: 1160px;
  margin: 0 auto;
  padding: 28px 18px 70px
}

.panel {
  background: #151d30;
  border: 1px solid #29354b;
  border-radius: 15px;
  padding: 23px;
  margin-bottom: 20px;
  box-shadow: 0 10px 24px #05091425
}

.topbar,
.section-head,
.actions,
.log-tools,
.method-head,
.role-bar,
.form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap
}

.topbar {
  gap: 20px
}

h1 {
  margin: 4px 0 9px;
  font-size: 27px
}

h2 {
  margin: 0 0 7px;
  font-size: 19px
}

h3 {
  margin: 0 0 8px;
  font-size: 16px
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 2px;
  color: #7eaeff
}

.muted,
.hint {
  color: #9caac3;
  font-size: 13px;
  margin: 0;
  overflow-wrap: anywhere
}

.hint {
  margin-top: 12px
}

.wallet-box {
  text-align: right
}

.wallet-address {
  font-family: ui-monospace, monospace;
  margin-bottom: 10px;
  font-size: 13px;
  overflow-wrap: anywhere
}

.section-head {
  margin-bottom: 20px
}

.actions {
  justify-content: flex-start
}

button,
select,
input,
textarea {
  font: inherit
}

button {
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 9px 13px;
  font-size: 13px;
  font-weight: 600;
  transition: filter .12s
}

button:hover:not(:disabled) {
  filter: brightness(1.16)
}

button:disabled {
  opacity: .45;
  cursor: not-allowed
}

.primary {
  background: #477ee8;
  color: #fff
}

.secondary {
  background: #27354c;
  color: #e5eeff;
  border-color: #364760
}

.danger {
  background: #c44252;
  color: white
}

.danger-outline {
  background: transparent;
  border-color: #9b4b5c;
  color: #ff9caa
}

.pill,
.status {
  display: inline-block;
  border-radius: 99px;
  padding: 5px 10px;
  background: #26364e;
  color: #bed3fb;
  font-size: 12px
}

.status.allowed,
.status.success {
  background: #153e36;
  color: #84e3b5
}

.status.denied,
.status.error {
  background: #4d2634;
  color: #ffa6b0
}

.status.pending,
.status.unknown {
  background: #493b23;
  color: #ffd28b
}

.balance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px
}

.balance-card {
  background: #1b2940;
  border: 1px solid #2e3d55;
  padding: 18px;
  border-radius: 12px
}

.balance-card .amount {
  font-size: 25px;
  font-weight: 700;
  overflow-wrap: anywhere;
  margin: 11px 0
}

.balance-card .token {
  font-size: 14px;
  color: #b9c9e5
}

.methods {
  display: grid;
  gap: 15px
}

.method-card {
  border: 1px solid #34435d;
  background: #19253a;
  border-radius: 12px;
  padding: 19px
}

.method-head {
  margin-bottom: 13px
}

.method-signature,
.mono {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
  color: #9eafd0
}

.role-bar {
  justify-content: flex-start;
  background: #202e45;
  border-radius: 9px;
  padding: 12px;
  margin: 12px 0
}

.role-bar .status {
  margin-right: auto
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 13px;
  margin: 14px 0
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0
}

.field label {
  font-size: 13px;
  font-weight: 600
}

.field small {
  color: #9cabbe;
  overflow-wrap: anywhere
}

.field input,
.field textarea,
.log-tools input,
.log-tools select {
  width: 100%;
  background: #101a2c;
  border: 1px solid #3a4a62;
  border-radius: 8px;
  padding: 11px;
  color: #f2f5ff;
  outline: none
}

.field input:focus,
.field textarea:focus,
.log-tools input:focus {
  border-color: #79a4ff
}

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

.field .bool-control {
  width: auto;
  align-self: start
}

.field.nested {
  background: #202e45;
  padding: 12px;
  border-radius: 9px
}

.result {
  background: #0e192b;
  border-radius: 9px;
  border: 1px solid #2c415f;
  margin-top: 13px;
  padding: 13px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  max-height: 300px;
  overflow: auto
}

.result:empty {
  display: none
}

.empty {
  color: #9cabbe;
  text-align: center;
  padding: 24px
}

.log-tools {
  justify-content: flex-start;
  margin-bottom: 12px
}

.log-tools input {
  flex: 1;
  min-width: 180px
}

.log-tools select {
  width: auto
}

.check {
  font-size: 12px;
  color: #c7d3e8;
  white-space: nowrap
}

.log-console {
  background: #080f1c;
  border: 1px solid #27354b;
  border-radius: 10px;
  min-height: 220px;
  max-height: 370px;
  overflow: auto;
  padding: 12px;
  font: 12px/1.65 ui-monospace, Consolas, monospace
}

.log-line {
  display: flex;
  gap: 10px;
  border-bottom: 1px solid #ffffff0b;
  padding: 5px 2px;
  white-space: pre-wrap;
  overflow-wrap: anywhere
}

.log-time {
  color: #8291ad;
  white-space: nowrap
}

.log-tag {
  min-width: 65px;
  color: #90b6ff
}

.log-line.SUCCESS .log-tag {
  color: #80e6b5
}

.log-line.ERROR .log-tag {
  color: #ff8799
}

.log-line.WARN .log-tag,
.log-line.TX .log-tag {
  color: #ffd18a
}

.log-message {
  min-width: 0
}

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  max-width: 450px;
  background: #314563;
  color: white;
  padding: 12px 16px;
  border-radius: 10px;
  box-shadow: 0 10px 30px #0008;
  display: none;
  overflow-wrap: anywhere;
  z-index: 10
}

dialog {
  background: #1c293f;
  color: #edf2ff;
  border: 1px solid #4c5e78;
  border-radius: 12px;
  max-width: 500px;
  width: calc(100% - 32px);
  padding: 23px
}

dialog::backdrop {
  background: #000a
}

dialog p {
  color: #c0cce0;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere
}

.end {
  justify-content: flex-end;
  margin-top: 18px
}

@media(max-width:600px) {
  .shell {
    padding: 12px
  }

  .panel {
    padding: 15px
  }

  .wallet-box {
    text-align: left
  }

  .form-grid {
    grid-template-columns: 1fr
  }

  .log-line {
    gap: 6px;
    font-size: 11px
  }

  .log-time {
    font-size: 10px
  }

  .log-tag {
    min-width: 48px
  }
}

/* Log toolbar: keep checkbox compact and prevent search input overflow. */
.log-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap
}

.log-tools #logSearch {
  flex: 1 1 240px;
  width: auto;
  min-width: 0
}

.log-tools .check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  white-space: nowrap;
  cursor: pointer
}

.log-tools .check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  flex: none;
  margin: 0;
  padding: 0;
  accent-color: #79a4ff
}

@media(max-width:600px) {
  .log-tools #logSearch {
    flex-basis: 100%
  }
}

/* Contract parameter alignment: reserve an identical label area in every column.
   Long custom ABI titles scroll within the label instead of shifting inputs. */
.form-grid>.field>label {
  display: block;
  height: 3.6em;
  min-height: 3.6em;
  line-height: 1.2;
  overflow-y: auto;
  overflow-x: hidden;
  overflow-wrap: anywhere;
  align-content: end;
}

.form-grid>.field>input,
.form-grid>.field>textarea {
  min-width: 0;
  margin: 0;
}