/* ============================================================
   MIND CHAIN — wallet page additions (loads after ../assets/style.css)
   Same tokens: dark #0b0d11, gold #d2ab60, mono accents.
   ============================================================ */

/* ---- sticky topbar: devnet banner + floating nav pill in one stack ---- */
.wallet-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  /* only the banner and the nav pill catch clicks; the gap passes through */
  pointer-events: none;
}
.devnet-banner {
  pointer-events: auto;
  display: flex;
  justify-content: center;
  gap: 0.6em;
  padding: 0.42rem 1rem;
  background: linear-gradient(90deg, rgba(210, 171, 96, 0.16), rgba(210, 171, 96, 0.08));
  border-bottom: 1px solid var(--gold-line);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}
.devnet-banner .mock-flag {
  color: var(--warn);
  border-left: 1px solid var(--gold-line);
  padding-left: 0.6em;
}

/* the nav pill flows below the banner inside the sticky topbar */
.wallet-page .nav-shell { position: static; }

.wallet-hero {
  position: relative;
  padding-top: clamp(3.5rem, 8vw, 6rem);
  padding-bottom: clamp(1.5rem, 4vw, 2.5rem);
}

.key-warning {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  max-width: 60rem;
  margin-top: 1.6rem;
  padding: 0.9rem 1.15rem;
  border: 1px solid rgba(201, 138, 94, 0.4);
  border-radius: 14px;
  background: rgba(201, 138, 94, 0.08);
  font-size: 0.9rem;
  color: var(--muted);
}
.key-warning strong { color: var(--warn); }
.key-warning svg { flex: none; margin-top: 0.15rem; }

.endpoint-line {
  margin-top: 1.1rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--dim);
  letter-spacing: 0.04em;
  overflow-wrap: anywhere;
}
.endpoint-line b { color: var(--muted); font-weight: 500; }

/* ---- wallet grid ---- */
.wallet-section { padding-block: clamp(1rem, 3vw, 2rem) clamp(4rem, 8vw, 6rem); }

.wallet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
  gap: 1.2rem;
  margin-top: 1.5rem;
}

.wallet-card {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1.35rem 1.35rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface), var(--bg-raise));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.wallet-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
}
.wallet-card-head h3 { font-size: 1.06rem; letter-spacing: -0.01em; }
.wallet-kind {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
  white-space: nowrap;
}

.wallet-pk {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
}
.wallet-pk code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  direction: ltr;
}
.icon-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}
.icon-btn:hover { color: #fff; border-color: var(--line-strong); }

.wallet-balance { display: flex; align-items: baseline; gap: 0.55rem; flex-wrap: wrap; }
.wallet-balance .amount {
  font-size: clamp(1.6rem, 3vw, 2rem);
  font-weight: 650;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.wallet-balance .unit {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}
.wallet-meta {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--dim);
  min-height: 1em;
}
.wallet-meta.error { color: var(--warn); }

.wallet-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: auto; }
.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.42rem 0.95rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 550;
  font-family: var(--sans);
  cursor: pointer;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease), transform 0.3s var(--ease);
}
.chip-btn:hover { border-color: rgba(232, 234, 238, 0.34); background: rgba(255, 255, 255, 0.04); }
.chip-btn:active { transform: scale(0.97); }
.chip-btn.primary { background: var(--gold); border-color: var(--gold); color: #171207; }
.chip-btn.primary:hover { filter: brightness(1.07); }
.chip-btn.danger { color: var(--warn); border-color: rgba(201, 138, 94, 0.4); }
.chip-btn.danger:hover { background: rgba(201, 138, 94, 0.08); }
.chip-btn:disabled { opacity: 0.45; cursor: default; pointer-events: none; }

/* create-wallet placeholder card */
.wallet-card.create-card {
  align-items: center;
  justify-content: center;
  gap: 1rem;
  min-height: 220px;
  border-style: dashed;
  border-color: var(--line-strong);
  background: transparent;
  text-align: center;
}
.create-card p { font-size: 0.9rem; color: var(--dim); max-width: 26ch; }

.empty-state {
  margin-top: 1.4rem;
  padding: 2.5rem 1.5rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  text-align: center;
  color: var(--dim);
}

/* ---- dialogs ---- */
dialog.sheet {
  /* the site-wide `* { margin: 0 }` reset removes the UA's `margin: auto` */
  margin: auto;
  width: min(560px, calc(100vw - 2rem));
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  padding: 0;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}
dialog.sheet::backdrop {
  background: rgba(8, 10, 13, 0.72);
  backdrop-filter: blur(6px);
}
.sheet-inner { padding: 1.6rem 1.6rem 1.5rem; display: grid; gap: 1.1rem; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.sheet-head h3 { font-size: 1.2rem; }

.field { display: grid; gap: 0.4rem; }
.field label {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}
.field input, .field textarea, .field select {
  width: 100%;
  padding: 0.68rem 0.85rem;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--bg-raise);
  color: var(--text);
  font-size: 0.95rem;
  font-family: var(--sans);
  transition: border-color 0.3s var(--ease);
}
.field input.mono, .field textarea.mono { font-family: var(--mono); font-size: 0.85rem; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--gold-line);
}
.field textarea { min-height: 5.5em; resize: vertical; }
.field .hint { font-size: 0.8rem; color: var(--dim); }

.seg-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.seg-row .chip-btn[aria-pressed="true"] {
  background: var(--gold-soft);
  border-color: var(--gold-line);
  color: var(--gold);
}

.mnemonic-box {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.35rem 0.8rem;
  padding: 1rem;
  border: 1px solid var(--gold-line);
  border-radius: 14px;
  background: var(--gold-soft);
  font-family: var(--mono);
  font-size: 0.82rem;
  counter-reset: word;
}
.mnemonic-box span { counter-increment: word; white-space: nowrap; }
.mnemonic-box span::before {
  content: counter(word) " ";
  display: inline-block;
  min-width: 1.7em;
  color: var(--dim);
  font-size: 0.68rem;
}

/* ---- send preview ---- */
.preview-table {
  display: grid;
  gap: 0.45rem;
  padding: 1rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-raise);
  font-size: 0.9rem;
}
.preview-row { display: flex; justify-content: space-between; gap: 1rem; }
.preview-row dt { color: var(--dim); }
.preview-row dd { font-family: var(--mono); font-size: 0.84rem; text-align: right; word-break: break-all; }
.preview-row.total { border-top: 1px solid var(--line); padding-top: 0.55rem; margin-top: 0.2rem; }
.preview-row.total dd { color: var(--gold); }

.status-line {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
  color: var(--muted);
  min-height: 1.4em;
}
.status-line.ok { color: var(--good); }
.status-line.error { color: var(--warn); }
.spinner {
  flex: none;
  width: 0.95rem;
  height: 0.95rem;
  border: 2px solid var(--line-strong);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: wallet-spin 0.8s linear infinite;
}
@keyframes wallet-spin { to { transform: rotate(360deg); } }

.txid-link { font-family: var(--mono); font-size: 0.82rem; color: var(--gold); word-break: break-all; }
.txid-link:hover { color: #e8c98a; }

/* ---- history ---- */
.history-list { display: grid; gap: 0.5rem; max-height: 45vh; overflow-y: auto; }
.history-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.8rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-raise);
  font-size: 0.85rem;
}
.history-row .dir {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.22em 0.7em;
  border-radius: 999px;
}
.history-row .dir.live { color: var(--good); border: 1px solid rgba(127, 191, 142, 0.35); }
.history-row .dir.spent { color: var(--dim); border: 1px solid var(--line-strong); }
.history-row .note-id { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-row .value { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---- toasts ---- */
.toast-stack {
  position: fixed;
  bottom: 1.2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: grid;
  gap: 0.5rem;
  width: min(420px, calc(100vw - 2rem));
}
.toast {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  font-size: 0.88rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  animation: toast-in 0.35s var(--ease);
}
.toast.error { border-color: rgba(201, 138, 94, 0.5); color: var(--warn); }
.toast.ok { border-color: rgba(127, 191, 142, 0.4); color: var(--good); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ---- mobile ---- */
@media (max-width: 860px) {
  /* the base stylesheet hides .nav-cta behind a burger menu; the wallet page
     has no burger, so keep its single CTA visible */
  .wallet-page .nav-cta { display: inline-flex; }
}
@media (max-width: 700px) {
  /* darken the strip behind the floating pill so scrolled text fades out
     instead of colliding with the banner */
  .wallet-topbar {
    background: linear-gradient(180deg, var(--bg) 72%, transparent);
  }
  .wallet-page .nav-shell { padding-top: 0.55rem; }
  .devnet-banner {
    flex-wrap: wrap;
    row-gap: 0;
    font-size: 0.62rem;
    letter-spacing: 0.12em;
  }
}
@media (max-width: 480px) {
  .wallet-grid { grid-template-columns: 1fr; }
  .wallet-actions .chip-btn { flex: 1 1 auto; justify-content: center; }
  .sheet-inner { padding: 1.2rem 1.1rem 1.1rem; }
  .preview-row dd { font-size: 0.75rem; }
}

/* ---- test page ---- */
.test-log {
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.9;
  padding: 1.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-raise);
  white-space: pre-wrap;
  word-break: break-all;
}
.test-log .pass { color: var(--good); }
.test-log .fail { color: #e06c6c; }
.test-log .head { color: var(--gold); }
