:root {
  --bg: #000;
  --card: #0a0a0a;
  --card-2: #111;
  --line: #262626;
  --line-2: #1c1c1c;
  --text: #ededed;
  --muted: #a1a1a1;
  --dim: #6e6e6e;
  --ok: #4ade80;
  --warn: #fbbf24;
  --bad: #f87171;
  --blue: #52a8ff;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  min-height: 100vh;
  font: 14px/1.5 Inter, system-ui, -apple-system, Segoe UI, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.hp { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }

/* ---------- buttons and fields ---------- */
.btn {
  height: 40px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { background: #161616; border-color: #3a3a3a; }
.btn.primary { background: #ededed; border-color: #ededed; color: #0a0a0a; }
.btn.primary:hover { background: #fff; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 6px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link { color: var(--blue); }
.link:hover { text-decoration: underline; }

.field { display: block; margin-top: 14px; }
.field > span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 13px; }
.input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: #555; }
.input:focus { border-color: #8f8f8f; box-shadow: 0 0 0 3px rgba(255,255,255,.08); }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #888 50%), linear-gradient(135deg, #888 50%, transparent 50%); background-position: calc(100% - 17px) 17px, calc(100% - 12px) 17px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.msg { min-height: 20px; margin: 12px 0 0; font-size: 13px; color: var(--muted); }
.msg.err { color: var(--bad); }
.msg.ok { color: var(--ok); }

/* ---------- auth (sign up / log in) ---------- */
.auth-top {
  height: 64px;
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: inline-flex; align-items: center; gap: 9px; font-size: 18px; font-weight: 600; letter-spacing: -.03em; }
.auth-wrap { min-height: calc(100vh - 64px); display: grid; place-items: center; padding: 24px 16px 64px; }
.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 44px 40px 28px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  text-align: center;
  animation: rise .5s cubic-bezier(.16, 1, .3, 1) both;
}
.auth-card h1 { margin: 0 0 28px; font-size: 24px; font-weight: 600; line-height: 1.25; letter-spacing: -.03em; }
.auth-card form { text-align: left; }
.auth-card .btn.primary { margin-top: 12px; }
.auth-alt { margin: 22px 0 0; color: var(--muted); font-size: 14px; }
.auth-legal { margin: 40px 0 0; color: var(--dim); font-size: 12px; }
.auth-legal a { color: var(--text); }
.auth-sent .mark {
  width: 48px;
  height: 48px;
  margin: 0 auto 20px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
}
.auth-sent p { margin: 0; color: var(--muted); }
.auth-sent b { color: var(--text); font-weight: 500; }
.auth-sent .actions { margin-top: 24px; display: grid; gap: 10px; }
.auth-foot { margin-top: 28px; color: var(--dim); font-size: 12px; text-align: center; }
.spinner { width: 22px; height: 22px; margin: 0 auto 18px; border: 2px solid #333; border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- app shell ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 64px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--line-2);
  background: rgba(0,0,0,.85);
  backdrop-filter: blur(12px);
}
.top .brand { font-size: 16px; }
.top .slash { color: #333; font-size: 22px; font-weight: 300; }
.top .who { min-width: 0; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.top .spacer { flex: 1; }
.modes { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); }
.modes button { height: 28px; padding: 0 12px; border: 0; border-radius: 999px; background: none; color: var(--muted); font-size: 13px; }
.modes button.on { background: #262626; color: #fff; }
.modes button[data-mode="test"].on { background: #2a2005; color: var(--warn); }
.tabs { height: 46px; padding: 0 24px; display: flex; gap: 22px; border-bottom: 1px solid var(--line-2); overflow-x: auto; }
.tabs a { position: relative; display: flex; align-items: center; color: var(--muted); font-size: 14px; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a.on { color: #fff; }
.tabs a.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: #fff; }
.tabs .biz { margin-left: auto; color: var(--text); }

.page { width: min(1000px, calc(100% - 32px)); margin: 0 auto; padding: 36px 0 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-head h1 { margin: 0; font-size: 28px; font-weight: 600; letter-spacing: -.04em; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

.banner {
  margin-bottom: 20px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--muted);
}
.banner.sandbox { border-color: #3d2f08; background: #110d02; color: #e5c56a; }
.banner b { color: var(--text); font-weight: 500; }

.card { border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.card + .card, .grid + .card, .card + .grid { margin-top: 16px; }
.card-head { padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line-2); }
.card-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.card-head p { margin: 2px 0 0; color: var(--dim); font-size: 13px; }
.card-body { padding: 20px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

.balance { padding: 28px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.balance small { color: var(--muted); font-size: 13px; }
.balance strong { display: block; margin-top: 6px; font-size: clamp(36px, 6vw, 52px); font-weight: 600; line-height: 1; letter-spacing: -.05em; }
.balance strong em { margin-left: 6px; color: var(--dim); font-size: .4em; font-style: normal; letter-spacing: 0; }
.balance .usd { margin-top: 8px; color: var(--muted); }
.balance .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.balance .actions .btn.on { border-color: #ededed; }

.panel { padding: 20px; border-top: 1px solid var(--line-2); }
.panel h3 { margin: 0; font-size: 15px; font-weight: 600; }
.panel p.note { margin: 4px 0 0; color: var(--dim); font-size: 13px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.chips button { height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: none; color: var(--muted); font-size: 13px; }
.chips button.on, .chips button:hover { border-color: #ededed; color: #fff; }

.list { margin: 0; padding: 0; list-style: none; }
.list li { padding: 14px 20px; display: flex; align-items: center; gap: 14px; border-top: 1px solid var(--line-2); }
.list li:first-child { border-top: 0; }
.list .ico { width: 32px; height: 32px; flex: 0 0 32px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); font-size: 14px; }
.list .what { flex: 1; min-width: 0; }
.list .what b { display: block; overflow: hidden; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.list .what span { color: var(--dim); font-size: 13px; }
.list .amt { font-family: var(--mono); font-size: 13px; white-space: nowrap; }
.list .amt.in { color: var(--ok); }
.empty { padding: 36px 20px; color: var(--dim); text-align: center; }

.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.tag.ok { border-color: #14532d; color: var(--ok); }
.tag.warn { border-color: #4d3a0a; color: var(--warn); }
.tag.bad { border-color: #5b1d1d; color: var(--bad); }

.key {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  font-family: var(--mono);
  font-size: 13px;
  overflow: hidden;
}
.key code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.key.fresh { border-color: #14532d; }
pre.code {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: #cfcfcf;
  font: 12.5px/1.7 var(--mono);
}
pre.code b { color: #fff; font-weight: 500; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; margin: 0; }
.kv dt { color: var(--dim); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

.foot { width: min(1000px, calc(100% - 32px)); margin: 0 auto; padding: 24px 0 40px; display: flex; gap: 18px; flex-wrap: wrap; border-top: 1px solid var(--line-2); color: var(--dim); font-size: 13px; }
.foot a:hover { color: var(--text); }

.loading { min-height: 60vh; display: grid; place-items: center; }

@media (max-width: 720px) {
  .top { padding: 0 14px; gap: 10px; }
  .top .who, .top .slash { display: none; }
  .tabs { padding: 0 14px; gap: 18px; }
  .page { padding-top: 24px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .grid { grid-template-columns: 1fr; }
  .balance { padding: 22px; }
  .balance .actions { width: 100%; }
  .balance .actions .btn { flex: 1; padding: 0 10px; }
  .row { flex-direction: column; gap: 0; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 10px; }
  .auth-card { padding: 36px 22px 24px; }
  .list li { padding: 12px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
