[hidden] { display: none !important; }
body { min-height: 100vh; }
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 22px 14px; border-right: 1px solid var(--border); background: var(--bg-elevated); }
.side .logo { display: flex; align-items: center; gap: 10px; padding: 0 8px 26px; font-weight: 500; font-size: 18px; letter-spacing: -.02em; }
.side .logo svg { width: 28px; height: 28px; }
.side nav { display: grid; gap: 4px; }
.side nav button { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; border: 1px solid transparent; background: none; color: var(--text-muted); font-size: 13px; cursor: pointer; text-align: left; transition: background .2s, color .2s, border-color .2s; }
.side nav button:hover { color: var(--text); background: rgba(94,233,201,.05); }
.side nav button[aria-current="page"] { color: var(--text); background: var(--panel-2); border-color: var(--border); }
.side nav svg { width: 16px; height: 16px; opacity: .8; }
.side-foot { margin-top: auto; padding: 0 8px; font-size: 11px; color: var(--text-dim); line-height: 1.6; }
.side-foot .shield { width: 18px; height: 18px; color: var(--text-muted); margin-bottom: 14px; }
.side-foot b { display: block; color: var(--text); font-size: 13px; font-weight: 500; margin-bottom: 10px; }
.side-foot .links { display: flex; gap: 12px; margin-top: 18px; }
.side-foot a:hover { color: var(--text); }
.scrim-side { display: none; }

.main { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 32px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: rgba(5,12,11,.78); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); z-index: 20; }
.crumb { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-dim); min-width: 0; }
.crumb b { color: var(--text); font-weight: 500; }
.tb-actions { display: flex; gap: 10px; align-items: center; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 999px; border: 1px solid var(--border); color: var(--text-muted); background: none; cursor: pointer; }
.icon-btn:hover { color: var(--text); }
.menu-btn { display: none; }

.pill { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--border-soft); background: var(--panel); color: var(--text); font-size: 12px; cursor: pointer; white-space: nowrap; transition: border-color .2s, background .2s, transform .2s, opacity .2s; }
.pill:hover { border-color: var(--accent-dim); background: var(--panel-2); }
.pill:disabled { opacity: .45; cursor: not-allowed; }
.pill.light { background: #eaf7f3; color: #06110e; border-color: transparent; font-weight: 500; }
.pill.light:hover { background: #fff; transform: translateY(-1px); }
.pill.sm { padding: 6px 12px; font-size: 11px; }
.pill.ghost-danger { color: var(--bad); border-color: rgba(255,143,122,.25); background: none; }
.pill.ghost-danger:hover { background: rgba(255,143,122,.08); border-color: rgba(255,143,122,.5); }
.pill.danger-solid { background: var(--bad); color: #2a0b05; border-color: transparent; font-weight: 500; }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--good); box-shadow: 0 0 8px var(--good); }
.pill .w-ico { width: 16px; height: 16px; border-radius: 4px; }

.net-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; font-size: 11px; border: 1px solid var(--border); background: none; color: var(--text-muted); cursor: default; }
.net-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--good); box-shadow: 0 0 8px var(--good); }
.net-pill.wrong { color: var(--warm); border-color: rgba(255,179,107,.35); cursor: pointer; }
.net-pill.wrong::before { background: var(--warm); box-shadow: 0 0 8px var(--warm); }
.net-pill.demo::before { background: var(--warm); box-shadow: none; }

.wallet-menu { position: relative; }
.dropdown { position: absolute; right: 0; top: calc(100% + 8px); width: 230px; padding: 6px; border-radius: 14px; border: 1px solid var(--border-soft); background: var(--panel); box-shadow: 0 20px 60px -20px rgba(0,0,0,.8); animation: flip .2s; z-index: 30; }
.dropdown .dd-head { padding: 10px 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 4px; font-size: 11px; color: var(--text-dim); }
.dropdown .dd-head b { display: block; margin-top: 4px; font-family: var(--mono); font-weight: 400; color: var(--text); font-size: 12px; word-break: break-all; }
.dropdown button, .dropdown a { display: block; width: 100%; text-align: left; padding: 9px 10px; border-radius: 8px; border: 0; background: none; color: var(--text-muted); font-size: 12px; cursor: pointer; }
.dropdown button:hover, .dropdown a:hover { background: var(--panel-2); color: var(--text); }
.dropdown .danger { color: var(--bad); }

.content { padding: 56px 32px 80px; max-width: 1040px; }
.kicker { color: var(--accent); font-size: 12px; }
.content h1 { font-size: clamp(40px, 6vw, 64px); font-weight: 500; letter-spacing: -.05em; margin: 12px 0 10px; line-height: 1; }
.content .sub { color: var(--text-muted); font-size: 15px; margin: 0 0 36px; }
.card { border: 1px solid var(--border); border-radius: var(--radius); padding: 30px 32px; max-width: 640px;
  background: radial-gradient(120% 120% at 100% 0, rgba(30,64,54,.45), rgba(0,0,0,0) 60%), var(--panel); }
.card h3 { margin: 0 0 12px; font-size: 20px; font-weight: 500; letter-spacing: -.02em; }
.card p { margin: 0 0 22px; color: var(--text-muted); font-size: 13px; line-height: 1.6; max-width: 54ch; }
.card .row { display: flex; gap: 10px; flex-wrap: wrap; }
.empty { border: 1px dashed var(--border-soft); border-radius: var(--radius); padding: 44px 28px; text-align: center; color: var(--text-dim); font-size: 13px; line-height: 1.6; }
.empty b { display: block; color: var(--text); font-weight: 500; font-size: 15px; margin-bottom: 6px; }
.empty .pill { margin-top: 18px; }
.view { display: none; } .view.on { display: block; animation: flip .4s cubic-bezier(.2,.7,.2,1); }

.banner { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; font-size: 12px; color: var(--text-muted); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; background: var(--bg-elevated); }
.banner.warm { color: var(--warm); border-color: rgba(255,179,107,.25); background: rgba(255,179,107,.04); }
.banner .pill { margin-left: auto; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 22px; }
.stat { border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; background: var(--panel); }
.stat span { font-size: 11px; color: var(--text-dim); }
.stat b { display: block; margin-top: 8px; font-family: var(--mono); font-weight: 400; font-size: 22px; letter-spacing: .02em; }
.stat b small { font-size: 11px; color: var(--text-dim); margin-left: 4px; }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar h2 { margin: 0; font-size: 14px; font-weight: 500; color: var(--text-muted); }
.toolbar .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* agents */
.agents { display: grid; gap: 10px; }
.agent { display: grid; grid-template-columns: auto 1fr auto auto; gap: 18px; align-items: center; padding: 16px 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--panel); transition: border-color .2s, background .2s; }
.agent:hover { border-color: var(--border-soft); background: var(--panel-2); }
.agent .av { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: rgba(94,233,201,.08); border: 1px solid var(--border-soft); font-family: var(--mono); font-size: 11px; color: var(--accent); }
.agent.paused .av { color: var(--text-dim); background: none; }
.agent b { font-weight: 500; font-size: 14px; }
.agent small { display: block; color: var(--text-dim); font-size: 11px; margin-top: 4px; font-family: var(--mono); }
.agent .bar { height: 3px; border-radius: 999px; background: var(--border); margin-top: 10px; overflow: hidden; max-width: 320px; }
.agent .bar i { display: block; height: 100%; background: var(--accent); transition: width .6s cubic-bezier(.2,.7,.2,1); }
.agent .bar i.hot { background: var(--warm); } .agent .bar i.full { background: var(--bad); }
.agent .vendors { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chip { font-size: 10px; font-family: var(--mono); padding: 3px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-muted); }
.status { font-size: 11px; display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--border); background: none; cursor: pointer; transition: border-color .2s, background .2s; }
.status:hover { border-color: var(--border-soft); background: var(--bg-elevated); }
.status.on { color: var(--good); } .status.off { color: var(--warm); }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.edit-btn { color: var(--text-dim); }

/* payments */
.ptable { width: 100%; border-collapse: collapse; font-size: 12px; }
.ptable th { text-align: left; font-weight: 400; color: var(--text-dim); font-size: 11px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.ptable td { padding: 12px; border-bottom: 1px solid var(--border); color: var(--text-muted); }
.ptable td.mono, .mono { font-family: var(--mono); }
.ptable tr.new td { animation: rowIn 1.2s ease-out; }
@keyframes rowIn { from { background: rgba(94,233,201,.12); } to { background: transparent; } }
.tag { font-size: 10px; padding: 3px 8px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.tag.ok { color: var(--good); } .tag.bad { color: var(--bad); }
.table-wrap { border: 1px solid var(--border); border-radius: 14px; background: var(--panel); overflow-x: auto; }
.table-wrap .ptable tr:last-child td { border-bottom: 0; }

/* integrations */
.code { position: relative; border: 1px solid var(--border); border-radius: 14px; background: #040a09; padding: 18px 20px; font-family: var(--mono); font-size: 12px; line-height: 1.7; color: var(--text-muted); overflow-x: auto; white-space: pre; }
.code .k { color: var(--accent); } .code .s { color: var(--warm); } .code .c { color: var(--text-faint); }
.code .copy { position: absolute; top: 12px; right: 12px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 0 0 22px; padding: 0; list-style: none; }
.steps li { border: 1px solid var(--border); border-radius: 14px; padding: 16px; background: var(--panel); font-size: 12px; color: var(--text-muted); line-height: 1.55; }
.steps li b { display: block; color: var(--text); font-weight: 500; font-size: 13px; margin: 6px 0 4px; }
.steps li span { font-family: var(--mono); font-size: 10px; color: var(--accent); }
.select { appearance: none; background: var(--panel); color: var(--text); border: 1px solid var(--border-soft); border-radius: 999px; padding: 8px 14px; font: inherit; font-size: 12px; }

/* settings */
.kv { display: grid; grid-template-columns: 180px 1fr; border: 1px solid var(--border); border-radius: 14px; background: var(--panel); overflow: hidden; margin-bottom: 22px; }
.kv > * { padding: 13px 16px; border-bottom: 1px solid var(--border); font-size: 12px; }
.kv > *:nth-last-child(-n+2) { border-bottom: 0; }
.kv dt { color: var(--text-dim); }
.kv dd { margin: 0; font-family: var(--mono); color: var(--text); word-break: break-all; }
.kv dd a { color: var(--accent); }
.section-title { font-size: 13px; color: var(--text-muted); font-weight: 500; margin: 0 0 12px; }

/* modals */
.modal { position: fixed; inset: 0; display: none; place-items: center; z-index: 50; background: rgba(2,6,5,.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); padding: 16px; }
.modal.open { display: grid; animation: flip .25s; }
.sheet { width: min(440px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; border: 1px solid var(--border-soft); border-radius: 20px; background: var(--panel); padding: 24px; box-shadow: 0 40px 120px -30px rgba(0,0,0,.9); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.sheet h3 { margin: 0; font-weight: 500; font-size: 18px; }
.sheet > p { margin: 6px 0 18px; color: var(--text-dim); font-size: 12px; line-height: 1.6; }
.x-btn { width: 30px; height: 30px; border-radius: 999px; border: 1px solid var(--border); background: none; color: var(--text-dim); cursor: pointer; font-size: 11px; }
.x-btn:hover { color: var(--text); border-color: var(--border-soft); }

.wallet { width: 100%; display: flex; align-items: center; gap: 14px; padding: 13px 14px; margin-bottom: 8px; border-radius: 14px; border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text); font-size: 14px; cursor: pointer; text-align: left; transition: border-color .2s, transform .2s, background .2s; }
.wallet:hover { border-color: var(--accent-dim); transform: translateY(-1px); background: var(--panel-2); }
.wallet:disabled { opacity: .6; cursor: progress; transform: none; }
.wallet .wi { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; overflow: hidden; }
.wallet .wi img { width: 100%; height: 100%; object-fit: cover; }
.wallet .meta { margin-left: auto; font-size: 11px; color: var(--text-dim); display: inline-flex; align-items: center; gap: 6px; }
.wallet .meta.found { color: var(--good); }
.wallet .meta.found::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--good); }
.wi-rh { background: linear-gradient(135deg, #d4ff3a, #8fd400); color: #0d1a00; }
.wi-mm { background: linear-gradient(135deg, #ffb057, #f2700f); color: #2b1100; }
.wi-gen { background: var(--panel-2); color: var(--accent); border: 1px solid var(--border-soft); }
.demo-wi { background: rgba(94,233,201,.08); color: var(--accent); border: 1px solid var(--border-soft); width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.or { display: flex; align-items: center; gap: 12px; margin: 14px 0; color: var(--text-faint); font-size: 11px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.demo-btn { width: 100%; display: flex; align-items: center; gap: 14px; padding: 13px 14px; border-radius: 14px; border: 1px dashed var(--border-soft); background: none; color: var(--text); text-align: left; cursor: pointer; transition: border-color .2s, background .2s; }
.demo-btn:hover { border-color: var(--accent-dim); background: rgba(94,233,201,.04); }
.demo-btn b { display: block; font-weight: 500; font-size: 13px; }
.demo-btn small { display: block; font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.cm-status { display: flex; align-items: center; gap: 10px; margin-top: 4px; padding: 11px 14px; border-radius: 12px; font-size: 12px; background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-muted); }
.cm-status.err { color: var(--bad); border-color: rgba(255,143,122,.3); }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border-soft); border-top-color: var(--accent); animation: spin .8s linear infinite; flex-shrink: 0; }

.field { display: block; margin-bottom: 16px; }
.field > span { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.field > span small { color: var(--text-faint); font-size: 10px; }
.field > span b { font-weight: 400; color: var(--text); font-size: 12px; }
.field input:not([type="range"]) { width: 100%; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--border-soft); background: var(--bg-elevated); color: var(--text); font: inherit; font-size: 13px; outline: none; transition: border-color .2s, box-shadow .2s; }
.field input:not([type="range"]):focus { border-color: var(--accent-dim); box-shadow: 0 0 0 3px rgba(94,233,201,.12); }
.field input.invalid { border-color: rgba(255,143,122,.6); }
.err { display: block; min-height: 0; font-style: normal; font-size: 11px; color: var(--bad); margin-top: 6px; }
.err:empty { display: none; }
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 999px; outline: none; cursor: pointer; margin: 8px 0;
  background: linear-gradient(to right, var(--accent) 0, var(--accent) var(--pct, 10%), var(--border) var(--pct, 10%), var(--border) 100%); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #eaf7f3; border: 3px solid var(--accent); box-shadow: 0 0 14px rgba(94,233,201,.5); }
.range::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #eaf7f3; border: 3px solid var(--accent); }
.form-actions { display: flex; gap: 8px; align-items: center; margin-top: 22px; flex-wrap: wrap; }
.spacer { flex: 1; }
.token-box { display: flex; gap: 10px; align-items: center; padding: 10px 10px 10px 14px; border-radius: 12px; border: 1px solid var(--border-soft); background: #040a09; }
.token-box code { flex: 1; font-family: var(--mono); font-size: 11px; color: var(--accent-strong); word-break: break-all; }

.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 80; max-width: min(360px, calc(100vw - 32px)); }
.toast { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border-soft); background: var(--panel); font-size: 12px; color: var(--text); box-shadow: 0 20px 50px -20px rgba(0,0,0,.8); animation: flip .3s; display: flex; gap: 10px; align-items: flex-start; }
.toast::before { content: ""; width: 7px; height: 7px; margin-top: 4px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.toast.bad::before { background: var(--bad); } .toast.warm::before { background: var(--warm); }
.toast.out { opacity: 0; transform: translateY(6px); transition: .3s; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .3s; }
  .side.open { transform: none; }
  .scrim-side.open { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(0,0,0,.5); }
  .menu-btn { display: grid; }
  .topbar { padding: 12px 16px; }
  .crumb-ws { display: none; }
  .content { padding: 36px 16px 64px; }
  .card { padding: 24px 20px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats .stat:last-child { grid-column: span 2; }
  .steps { grid-template-columns: 1fr; }
  .agent { grid-template-columns: auto 1fr; }
  .agent > .status, .agent > .edit-btn { grid-row: 2; }
  .agent > .status { grid-column: 1 / 2; justify-self: start; }
  .agent > .edit-btn { grid-column: 2; justify-self: end; }
  .kv { grid-template-columns: 1fr; }
  .kv dt { padding-bottom: 2px; border-bottom: 0; }
  .net-pill { display: none !important; }
}
@media (max-width: 420px) {
  .pill { padding: 8px 12px; }
  .ptable .hide-sm { display: none; }
}

/* wallet list helpers */
.nowallet { border: 1px dashed var(--border-soft); border-radius: 14px; padding: 16px; margin-bottom: 8px; font-size: 12px; color: var(--text-muted); }
.nowallet b { color: var(--text); font-weight: 500; font-size: 13px; }
.nowallet ul { margin: 10px 0 14px; padding-left: 18px; display: grid; gap: 8px; line-height: 1.5; }
.nowallet li b { font-size: 12px; }
.nowallet code { font-family: var(--mono); font-size: 11px; color: var(--accent-strong); }
.wl-foot { font-size: 11px; color: var(--text-dim); margin: 2px 2px 0; }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.getwallet { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-top: 12px; font-size: 11px; color: var(--text-faint); }
.getwallet a { color: var(--text-dim); }
.getwallet a:hover { color: var(--accent); }

/* ---- live backend UI ---- */
.loading { display: flex; align-items: center; gap: 10px; color: var(--text-dim); font-size: 13px; padding: 24px 0; }
.banner.live { color: var(--accent-strong); border-color: rgba(94,233,201,.22); background: rgba(94,233,201,.04); }
.agent-main { min-width: 0; }
.agent small .linkish { font-size: 11px; }
.chip.warn { color: var(--warm); border-color: rgba(255,179,107,.3); }
.fund-hint { margin-top: 10px; font-size: 12px; }
.row-actions { position: relative; display: flex; gap: 6px; align-items: center; }
.agent-menu { top: calc(100% + 6px); width: 220px; }
.agent-menu a { display: block; }
.tag.wait { color: var(--warm); }
.sub-cell { display: block; color: var(--text-faint); font-size: 10px; font-family: var(--mono); margin-top: 3px; }
.ptable a { color: var(--accent); }
.empty code, .steps code, .fund-p code { font-family: var(--mono); font-size: 11px; color: var(--accent-strong); }
.field textarea { width: 100%; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--border-soft); background: var(--bg-elevated); color: var(--text); font-family: var(--mono); font-size: 12px; line-height: 1.6; outline: none; resize: vertical; transition: border-color .2s, box-shadow .2s; }
.field textarea:focus { border-color: var(--accent-dim); box-shadow: 0 0 0 3px rgba(94,233,201,.12); }
.field textarea.invalid { border-color: rgba(255,143,122,.6); }
.select.wide { width: 100%; border-radius: 10px; padding: 11px 13px; font-family: var(--mono); font-size: 12px; }
.caps { font-size: 11px; color: var(--text-faint); margin: -4px 0 0; }
.cm-status.ok { color: var(--good); border-color: rgba(201,242,122,.3); }
.cm-status a { color: var(--accent); margin-left: 4px; }
.fund-h { margin: 22px 0 8px; font-size: 14px; font-weight: 500; }
.fund-p { font-size: 12px; color: var(--text-muted); line-height: 1.6; margin: 6px 0 14px; }
.fund-p b { color: var(--text); font-weight: 500; }
.fund-list { margin: 14px 0; padding-left: 18px; font-size: 12px; color: var(--text-muted); line-height: 1.7; }
.fund-list b { color: var(--text); font-weight: 500; }
@media (max-width: 860px) {
  .agent { grid-template-columns: auto 1fr; }
  .agent > .status { grid-row: 2; grid-column: 1 / 2; justify-self: start; }
  .agent > .row-actions { grid-row: 2; grid-column: 2; justify-self: end; }
  .agent-menu { right: 0; }
}
