:root {
  color-scheme: light;
  --paper: #f2efe5;
  --surface: #fffdf5;
  --ink: #101414;
  --muted: #626966;
  --line: #101414;
  --accent: #086b78;
  --accent-soft: #d5ecec;
  --danger: #a62d20;
  --warning: #fff0bd;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: "IBM Plex Mono", "DejaVu Sans Mono", ui-monospace, monospace;
  font-size: 15px;
  line-height: 1.45;
}

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

a {
  color: var(--accent);
  text-underline-offset: 3px;
}

.site-header,
main {
  width: min(1080px, calc(100% - 32px));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 38px 0 24px;
  border-bottom: 3px solid var(--line);
}

.site-header > div,
#status {
  min-width: 0;
}

#status {
  overflow-wrap: anywhere;
}

.site-header h1 {
  margin: 2px 0 0;
  font-size: clamp(32px, 6vw, 66px);
  line-height: 0.95;
  letter-spacing: -0.08em;
}

.site-header h1 span {
  color: var(--accent);
  padding-inline: 0.08em;
}

.site-header p,
.eyebrow {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

main {
  padding: 20px 0 64px;
}

.warning {
  padding: 13px 15px;
  border: 1px dashed var(--line);
  background: var(--warning);
}

.status-strip {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 54px;
  margin-top: 12px;
  padding: 7px 8px 7px 14px;
  border: 1px solid var(--line);
  background: var(--ink);
  color: var(--surface);
}

.status-dot {
  width: 9px;
  height: 9px;
  background: #8fe6c5;
}

.status-strip[data-state="busy"] .status-dot {
  background: #ffd35c;
}

.status-strip[data-state="error"] .status-dot {
  background: #ff6a54;
}

.status-strip button {
  border-color: var(--surface);
  background: transparent;
  color: var(--surface);
}

.pending-operation {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  margin-top: 10px;
  padding: 10px 13px;
  border: 1px solid #8a5700;
  background: var(--warning);
  color: #5c3a00;
  font-size: 12px;
}

.pending-operation[hidden] {
  display: none;
}

.balance-panel {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  margin: 16px 0;
  border: 2px solid var(--line);
  background: var(--accent-soft);
}

.balance-panel > div {
  min-width: 0;
  padding: 17px;
  border-right: 1px solid var(--line);
}

.balance-panel > div:last-child {
  border-right: 0;
}

.balance-panel span,
label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.balance-panel strong {
  display: block;
  overflow: hidden;
  font-size: clamp(18px, 3vw, 27px);
  text-overflow: ellipsis;
}

.network-cell strong {
  font-size: 17px;
}

.primary-grid,
.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.panel {
  border: 1px solid var(--line);
  background: var(--surface);
}

section.panel {
  padding: 18px;
}

.panel-heading {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: start;
  margin-bottom: 20px;
}

.panel-heading.compact {
  margin-bottom: 14px;
}

.step {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--ink);
  color: var(--surface);
  font-weight: 700;
}

h2 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -0.03em;
}

.panel-heading p,
.hint,
.recovery-body p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

form {
  display: grid;
  gap: 8px;
}

form label:not(:first-child) {
  margin-top: 7px;
}

textarea,
input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  padding: 10px;
}

textarea {
  min-height: 74px;
  resize: vertical;
  overflow-wrap: anywhere;
}

textarea[readonly] {
  background: #f8f6ee;
}

button,
.file-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  padding: 8px 13px;
  font-weight: 700;
  cursor: pointer;
}

button:hover,
.file-button:hover {
  background: var(--accent-soft);
}

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

button.primary:hover {
  background: #064f59;
}

button.danger {
  border-color: var(--danger);
  color: var(--danger);
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.file-button.disabled {
  cursor: not-allowed;
  opacity: 0.55;
  pointer-events: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
.file-button:focus-within {
  outline: 3px solid #005fcc;
  outline-offset: 2px;
}

.actions,
.input-action {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin-top: 9px;
  flex-wrap: wrap;
}

.input-action input {
  flex: 1 1 120px;
}

.input-action button {
  flex: 0 0 auto;
}

.hint {
  margin-top: 14px;
}

.coins-panel {
  margin-bottom: 16px;
}

.coin-list {
  display: grid;
  gap: 9px;
}

.empty-state {
  padding: 22px;
  border: 1px dashed var(--line);
  color: var(--muted);
  text-align: center;
}

.coin-card {
  display: grid;
  grid-template-columns: minmax(100px, 0.7fr) minmax(0, 1.8fr) auto;
  gap: 14px;
  align-items: start;
  padding: 13px;
  border: 1px solid var(--line);
  background: #fff;
}

.coin-amount {
  font-size: 20px;
  font-weight: 700;
}

.coin-meta {
  min-width: 0;
}

.coin-meta div {
  overflow: hidden;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coin-meta code {
  color: var(--ink);
}

.badge {
  display: inline-block;
  border: 1px solid currentColor;
  color: var(--accent);
  padding: 4px 7px;
  font-size: 10px;
  font-weight: 700;
}

.badge[data-status="TRANSFERRED"],
.badge[data-status="WITHDRAWN"] {
  color: var(--muted);
}

.badge[data-status="IN_MEMPOOL"],
.badge[data-status="UNCONFIRMED"],
.badge[data-status="IN_TRANSFER"],
.badge[data-status="WITHDRAWING"] {
  color: #8a5700;
}

details.panel {
  margin-top: 16px;
}

summary {
  padding: 15px 18px;
  font-weight: 700;
  cursor: pointer;
}

details[open] summary {
  border-bottom: 1px solid var(--line);
}

.recovery-body,
.activity-list {
  padding: 18px;
}

.recovery-body .actions {
  margin: 15px 0;
}

#import-backup {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.secret {
  min-height: 92px;
  border-color: var(--danger);
  color: var(--danger);
}

.secret-label {
  color: var(--danger);
}

.activity-list {
  display: grid;
  gap: 7px;
}

.activity-row {
  display: grid;
  grid-template-columns: 90px 100px 1fr;
  gap: 12px;
  padding-bottom: 7px;
  border-bottom: 1px dotted #aaa;
  font-size: 12px;
}

.activity-row code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 720px) {
  .primary-grid,
  .action-grid {
    grid-template-columns: 1fr;
  }

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

  .network-cell {
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
  }

  .balance-panel > div:nth-child(2) {
    border-right: 0;
  }

  .coin-card {
    grid-template-columns: 1fr auto;
  }

  .coin-meta {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

@media (max-width: 480px) {
  .site-header,
  main {
    width: min(100% - 20px, 1080px);
  }

  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
    padding-top: 24px;
  }

  .site-header p {
    max-width: 240px;
  }

  .status-strip {
    grid-template-columns: auto 1fr;
  }

  .status-strip button {
    grid-column: 1 / -1;
  }

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

  .balance-panel > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .network-cell {
    grid-column: auto;
    border-top: 0;
  }

  .balance-panel > div:last-child {
    border-bottom: 0;
  }

  .actions > *,
  .input-action > * {
    flex: 1 1 100%;
  }

  .activity-row {
    grid-template-columns: 80px 1fr;
  }

  .activity-row code {
    grid-column: 1 / -1;
  }

  footer {
    flex-direction: column;
  }
}
