:root {
  --bg: #f7f4ff; --card: #fff; --soft: #f2ecff; --line: #e7defb; --ink: #23164a; --muted: #85789f;
  --violet: #7c4dff; --violet2: #6a3cf0; --lilac: #b79cff; --pink: #ff6fb8; --green: #18b57a; --red: #e5486f; --amber: #f2a516;
  --r: 18px; --shadow: 0 1px 0 #e7defb, 0 10px 30px #6a3cf012;
  font-family: Inter, ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif; color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 14px; }
a { color: var(--violet); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
button:disabled { opacity: .5; cursor: default; }
code, .mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; }

.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 18px; padding: 12px 22px; background: #ffffffe8; backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 17px; color: var(--ink); }
.brand img { width: 30px; height: 30px; }
#tabs { display: flex; gap: 4px; }
#tabs a { padding: 8px 14px; border-radius: 12px; color: var(--muted); font-weight: 600; }
#tabs a.on { background: var(--soft); color: var(--violet2); }
.top-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
select, input, textarea { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 9px 11px; outline: none; width: 100%; }
select:focus, input:focus, textarea:focus { border-color: var(--lilac); box-shadow: 0 0 0 3px #b79cff33; }
#network { width: auto; font-weight: 600; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 13px; background: var(--violet); color: #fff; font-weight: 700; box-shadow: 0 3px 0 var(--violet2); transition: transform .08s; white-space: nowrap; }
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--violet2); }
.btn.small { height: 36px; padding: 0 14px; font-size: 13px; }
.btn.ghost { background: var(--soft); color: var(--violet2); box-shadow: none; }
.btn.pink { background: var(--pink); box-shadow: 0 3px 0 #db4f97; }
.btn.green { background: var(--green); box-shadow: 0 3px 0 #0f8c5d; }
.btn.red { background: var(--red); box-shadow: 0 3px 0 #b8304f; }
.btn.big { height: 52px; font-size: 16px; width: 100%; }

main { max-width: 1240px; margin: 0 auto; padding: 22px; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.side { position: sticky; top: 76px; display: grid; gap: 14px; }
.side .card + .card { margin-top: 0; }
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 14px; }
.card h2 { margin: 0 0 4px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.card h2 .n { width: 24px; height: 24px; border-radius: 8px; background: var(--soft); color: var(--violet2); display: grid; place-items: center; font-size: 12px; }
.card .sub { color: var(--muted); margin: 0 0 14px; font-size: 13px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.row + .row, .row + .field, .field + .row { margin-top: 12px; }
.field label { display: flex; justify-content: space-between; gap: 6px; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.field label i { font-style: normal; font-weight: 500; }
.field .unit { position: relative; }
.field .unit span { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; pointer-events: none; }
.field .unit input { padding-right: 58px; }
.seg { display: flex; background: var(--soft); border-radius: 12px; padding: 3px; gap: 3px; flex-wrap: wrap; }
.seg button { flex: 1; padding: 7px 10px; border-radius: 9px; font-weight: 700; color: var(--muted); font-size: 13px; }
.seg button.on { background: #fff; color: var(--violet2); box-shadow: 0 1px 3px #6a3cf022; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--soft); cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--violet); flex: none; }
.check b { display: block; font-size: 13px; } .check small { color: var(--muted); }
details.card summary { cursor: pointer; list-style: none; }
details.card summary::-webkit-details-marker { display: none; }
details.card summary h2::after { content: "▾"; margin-left: auto; color: var(--muted); }
details.card[open] summary { margin-bottom: 12px; }
.image-drop { display: flex; gap: 14px; align-items: center; }
.image-drop .pic { width: 84px; height: 84px; border-radius: 18px; background: var(--soft) center/cover; display: grid; place-items: center; color: var(--muted); font-size: 26px; border: 2px dashed var(--line); flex: none; cursor: pointer; }
.image-drop .pic.has { border: 0; }

.kv { display: grid; grid-template-columns: 1fr auto; gap: 7px 10px; font-size: 13px; }
.kv > span:nth-of-type(odd) { color: var(--muted); }
.kv > span:nth-of-type(even) { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.kv .hr { grid-column: 1 / -1; height: 1px; background: var(--line); margin: 3px 0; }
.big-num { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.muted { color: var(--muted); }
.warn { background: #fff6e0; color: #87580a; border-radius: 12px; padding: 10px 12px; font-size: 13px; }
.error { background: #ffe8ee; color: #a8213f; border-radius: 12px; padding: 10px 12px; font-size: 13px; white-space: pre-wrap; }
.ok { background: #e3f8ee; color: #0d6c48; border-radius: 12px; padding: 10px 12px; font-size: 13px; }
.chart { width: 100%; height: 150px; display: block; }
.sched { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.sched td { padding: 4px 0; border-bottom: 1px dashed var(--line); } .sched td:last-child { text-align: right; font-weight: 700; }
.bar { height: 10px; border-radius: 6px; background: var(--soft); overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--lilac), var(--violet)); border-radius: 6px; }
.split { display: flex; height: 10px; border-radius: 6px; overflow: hidden; margin-top: 8px; }
.split i { display: block; }

.tokens { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tok { display: flex; gap: 12px; align-items: center; cursor: pointer; }
.tok img, .tok .ph { width: 48px; height: 48px; border-radius: 14px; object-fit: cover; background: var(--soft); flex: none; }
.tok b { display: block; font-size: 15px; }
.pillx { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; background: var(--soft); color: var(--violet2); }
.pillx.grad { background: #e3f8ee; color: #0d6c48; }
.actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.act { text-align: left; padding: 12px; border-radius: 14px; background: var(--soft); }
.act b { display: block; } .act small { color: var(--muted); }
.act:hover:not(:disabled) { outline: 2px solid var(--lilac); }
.links { display: flex; gap: 8px; flex-wrap: wrap; }
.links a { padding: 6px 10px; border-radius: 10px; background: var(--soft); font-weight: 600; font-size: 13px; }
.copy { cursor: pointer; border-bottom: 1px dashed var(--lilac); }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.steps-run { display: grid; gap: 8px; margin-top: 12px; }
.steps-run div { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.steps-run i { width: 18px; height: 18px; border-radius: 50%; background: var(--line); flex: none; font-style: normal; display: grid; place-items: center; font-size: 11px; color: #fff; }
.steps-run .done i { background: var(--green); } .steps-run .run i { background: var(--violet); animation: pul 1s infinite; } .steps-run .fail i { background: var(--red); }
@keyframes pul { 50% { opacity: .4; } }
#toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 50; }
.toast { background: var(--ink); color: #fff; padding: 11px 15px; border-radius: 13px; max-width: 360px; box-shadow: 0 10px 30px #0003; font-weight: 600; font-size: 13px; }
.toast.bad { background: var(--red); } .toast.good { background: var(--green); }
.modal-back { position: fixed; inset: 0; background: #23164a55; display: grid; place-items: center; z-index: 40; padding: 16px; }
.modal { background: #fff; border-radius: 20px; padding: 20px; width: min(420px, 100%); max-height: 90vh; overflow: auto; }
.modal h3 { margin: 0 0 12px; }
.wallet-opt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px; border-radius: 14px; background: var(--soft); font-weight: 700; margin-bottom: 8px; }
.wallet-opt img { width: 28px; height: 28px; border-radius: 8px; }

@media (max-width: 960px) {
  .grid { grid-template-columns: 1fr; }
  .side { position: static; }
  .top { flex-wrap: wrap; padding: 10px 14px; gap: 10px; }
  #tabs { order: 3; width: 100%; overflow-x: auto; }
  main { padding: 14px; }
}
