:root {
  --bg: #0e1116;
  --panel: #161b23;
  --panel-2: #1c222c;
  --line: #262d38;
  --txt: #e6edf3;
  --muted: #8b98a9;
  --accent: #4c8dff;
  --accent-2: #2ea043;
  --warn: #d29922;
  --err: #f85149;
  --spam: #8957e5;
  --radius: 10px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f6f9;
    --panel: #fff;
    --panel-2: #f0f3f7;
    --line: #dde3ea;
    --txt: #12181f;
    --muted: #5d6b7d;
  }
}

* {
  box-sizing: border-box
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--txt);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif
}

.wrap {
  max-width: 1500px;
  margin: 0 auto;
  padding: 22px 18px 60px
}

h1 {
  font-size: 20px;
  margin: 0 0 15px;
}

.sub {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 18px
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px
}

.grid {
  display: grid;
  gap: 12px
}

.cfg {
  grid-template-columns: 1fr 160px 160px 160px auto auto;
  align-items: end
}

.wallet-field {
  grid-column: span 2
}

label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted);
  margin-bottom: 5px
}

input,
select {
  width: 100%;
  padding: 9px 10px;
  background: var(--panel-2);
  color: var(--txt);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  height: 40px;
  line-height: 40px;
  box-sizing: border-box;
  vertical-align: middle
}

input[type="checkbox"] {
  width: 16px !important;
  height: 16px !important;
  min-width: 16px;
  min-height: 16px;
  max-width: 16px;
  max-height: 16px;
  margin: 0;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
}

input[type="date"]
{ 
  max-width: 160px;
  width: 100%
}

input:focus,
select:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px
}

button {
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--txt);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  height: 40px;
}

button:hover:not(:disabled) {
  border-color: var(--accent)
}

button:disabled {
  opacity: .5;
  cursor: not-allowed
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff
}

button.exp {
  background: transparent;
  border-color: var(--accent-2);
  color: var(--accent-2)
}

button.exp:hover:not(:disabled) {
  background: rgba(46, 160, 67, .12)
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center
}

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px
}

.stat {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px
}

.stat b {
  display: block;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -.3px
}

.stat span {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px
}

.tbl-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel)
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12.5px
}

th {
  position: sticky;
  top: 0;
  background: var(--panel-2);
  text-align: left;
  padding: 9px 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  white-space: nowrap;
  z-index: 2
}

th:hover {
  color: var(--txt)
}

td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top
}

tr:last-child td {
  border-bottom: none
}

tr:hover td {
  background: var(--panel-2)
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px
}

a {
  color: var(--accent);
  text-decoration: none
}

a:hover {
  text-decoration: underline
}

.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 500;
  background: var(--panel-2);
  border: 1px solid var(--line);
  white-space: nowrap
}

.ok {
  color: var(--accent-2);
  border-color: rgba(46, 160, 67, .4)
}

.fail {
  color: var(--err);
  border-color: rgba(248, 81, 73, .4)
}

.spam-b {
  color: var(--spam);
  border-color: rgba(137, 87, 229, .45)
}

.in {
  color: var(--accent-2);
  font-weight: 600
}

.out {
  color: var(--err);
  font-weight: 600
}

.neutral {
  color: var(--muted)
}

tr.spam td {
  opacity: .62
}

.log {
  font-family: ui-monospace, monospace;
  font-size: 11.5px;
  color: var(--muted);
  max-height: 130px;
  overflow: auto;
  white-space: pre-wrap;
  margin-top: 10px
}

.err-box {
  background: rgba(248, 81, 73, .1);
  border: 1px solid rgba(248, 81, 73, .4);
  color: var(--err);
  padding: 10px 12px;
  border-radius: 8px;
  margin-top: 10px;
  font-size: 13px
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px
}

.chk {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--txt);
  cursor: pointer
}

.chk input {
  width: auto
}

.nowrap {
  white-space: nowrap
}

.tag {
  font-size: 10.5px;
  color: var(--muted);
  display: block
}

.bar {
  height: 3px;
  background: var(--panel-2);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 10px
}

.bar>i {
  display: block;
  height: 100%;
  background: var(--accent);
  width: 0;
  transition: width .25s
}

.filter-mode {
  margin-bottom: 6px
}

.multi {
  position: relative
}

.multi summary {
  list-style: none;
  min-height: 38px;
  padding: 9px 30px 9px 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.multi summary::-webkit-details-marker {
  display: none
}

.multi summary:after {
  content: '⌄';
  position: absolute;
  right: 10px;
  color: var(--muted)
}

.multi[open] summary {
  border-color: var(--accent);
  border-radius: 8px 8px 0 0
}

.multi-options {
  position: absolute;
  z-index: 5;
  max-height: 260px;
  overflow: auto;
  width: 100%;
  padding: 7px;
  background: var(--panel);
  border: 1px solid var(--accent);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 12px 24px #0006
}

.multi-options label {
  display: flex;
  gap: 7px;
  align-items: center;
  padding: 6px 4px;
  margin: 0;
  color: var(--txt);
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
  cursor: pointer
}

.multi-options input {
  width: auto
}

.balances {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
  margin-top: 14px
}

.balance {
  position: relative;
  padding: 10px 32px 10px 12px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 8px
}

.balance b {
  display: block;
  font-size: 15px
}

.balance small {
  color: var(--muted);
  display: block;
  margin-top: 4px
}

.debit {
  color: var(--err)
}

.credit {
  color: var(--accent-2)
}

.close-balance {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 0;
  width: 20px;
  height: 20px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 18px
}

.close-balance:hover {
  color: var(--txt);
  background: var(--line)
}

.modal[hidden] {
  display: none
}

.modal {
  position: fixed;
  z-index: 20;
  inset: 0;
  background: #06080ccc;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px
}

.modal-card {
  width: min(920px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 24px 60px #0009
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start
}

.modal-head h2 {
  margin: 0;
  font-size: 20px
}

.modal-close {
  font-size: 24px;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--muted)
}

.label-candidate {
  display: grid;
  grid-template-columns: 24px minmax(180px, 1fr) minmax(160px, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px 0;
  border-top: 1px solid var(--line)
}

.label-candidate:first-child {
  border-top: 0
}

.label-candidate input[type="checkbox"] {
  margin-top: 10px
}

.label-candidate input {
  width: 100%;
  margin-top: 6px
}

.label-candidate .mono {
  font-size: 11px;
  color: var(--muted);
  word-break: break-all
}

.label-candidate small {
  display: block;
  color: var(--muted);
  margin-top: 5px
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0
}

.header-actions #load {
  flex: 1
}

.settings-button {
    display: flex;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    flex: none;
    justify-content: center
}

.settings-button svg {
  position: relative;
  width: 26px;
  height: 26px;
  fill: #515151;
}

.lang-switch {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden
}

.lang-switch button {
  border: 0;
  border-radius: 0;
  padding: 9px 10px
}

.lang-switch button[aria-current="true"] {
  background: var(--accent);
  color: #fff
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px
}

.settings-columns {
  display: grid;
  grid-template-columns: 
    minmax(100px, auto)
    minmax(100px, auto)
    minmax(100px, auto)
    minmax(100px, auto)
    minmax(100px, auto)
    minmax(100px, auto)
    minmax(100px, auto);
  width: 100%;
  gap: 10px
}

.settings-columns label {
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--txt);
  margin: 0;
}
/*
.settings-columns input {
  width: auto;
  margin-right: 6px
}
*/
.col-hidden {
  display: none
}

@media(max-width:1100px) {
  .cfg {
    grid-template-columns: repeat(4, minmax(0, 1fr))
  }

  .wallet-field {
    grid-column: span 2
  }
}

@media(max-width:760px) {
  .cfg {
    grid-template-columns: repeat(2, minmax(0, 1fr))
  }

  .wallet-field {
    grid-column: span 2
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr))
  }

  .header-actions {
    grid-column: span 2;
    width: 100%
  }
}

@media(max-width:640px) {
  .label-candidate {
    grid-template-columns: 24px 1fr
  }

  .label-candidate .label-fields {
    grid-column: 2
  }

  .modal {
    padding: 8px
  }

  .modal-card {
    max-height: calc(100vh - 16px);
    padding: 14px
  }
}

/* Применяем ко всем основным полям ввода */

#chain {
  max-width: 160px; 
  width: 100%;
}

/* Настройки */
#settingsFilters label.chk:first-of-type {
  grid-column: 1 / span 2;
}

#settingsFilters {
  grid-template-columns: repeat(4, 1fr);
}

#settingsFilters label.chk {
  grid-column: span 2;
  align-self: start;
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-columns label {
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}