:root {
  --abyss: #0A0F24;
  --hull: #121937;
  --hull-2: #18214a;
  --seam: #253058;
  --signal: #4FD1FF;
  --ion: #8B6CFF;
  --ink: #E8ECFF;
  --haze: #8C95BF;
  --bar: #1E9FD6;
  --ok: #3DDC97;
  --warn: #FFB547;
  --bad: #FF6B81;
  --r-lg: 22px;
  --r-md: 14px;
  --r-sm: 9px;
  --display: 'Unbounded', system-ui, sans-serif;
  --ui: 'Manrope', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
.btn svg { width: 16px; height: 16px; flex: none; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--abyss);
  background-image: radial-gradient(1200px 600px at 85% -10%, rgba(139,108,255,.14), transparent 60%),
                    radial-gradient(900px 500px at -10% 110%, rgba(79,209,255,.08), transparent 60%);
  background-attachment: fixed;
  color: var(--ink);
  font: 500 15px/1.55 var(--ui);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--signal); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: 1.6rem; line-height: 1.2; }
h2 { font-size: 1.05rem; line-height: 1.3; }
h3 { font-size: .92rem; }
p { margin: 0; }
.muted { color: var(--haze); }
.mono { font-family: var(--mono); font-size: .86em; }
.num { font-family: var(--display); font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; border-radius: 6px; }
::selection { background: rgba(79,209,255,.35); }

/* ---------- botões e campos ---------- */
.btn {
  appearance: none; border: 1px solid var(--seam); background: var(--hull-2); color: var(--ink);
  font: 600 .9rem var(--ui); padding: .62rem 1rem; border-radius: var(--r-sm); cursor: pointer;
  display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap;
}
.btn:hover { border-color: #3a4780; }
.btn:hover { text-decoration: none; }
.btn.primary { background: var(--signal); color: #04122a; border-color: transparent; }
.btn.primary:hover { background: #79ddff; }
.btn.danger { color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.sm { padding: .38rem .7rem; font-size: .82rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
label.field { display: grid; gap: .35rem; font-size: .84rem; color: var(--haze); }
input, select, textarea {
  width: 100%; background: #0d1430; border: 1px solid var(--seam); color: var(--ink);
  font: 500 .95rem var(--ui); padding: .65rem .8rem; border-radius: var(--r-sm);
}
textarea { font-family: var(--mono); font-size: .82rem; min-height: 140px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--signal); box-shadow: 0 0 0 3px rgba(79,209,255,.18); }
.check { display: flex; align-items: center; gap: .5rem; color: var(--ink); font-size: .9rem; }
.check input { width: auto; }

/* ---------- login ---------- */
.auth { display: grid; grid-template-columns: 1.25fr 1fr; min-height: 100vh; }
.auth-visual { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 40px 48px; }
.auth-visual .globe { position: absolute; inset: 0; }
.auth-visual .globe canvas { width: 100% !important; height: 100% !important; cursor: grab; }
.auth-brand, .auth-pitch { position: relative; z-index: 1; pointer-events: none; }
.auth-visual::after { content: ''; position: absolute; inset: 45% 0 0 0; background: linear-gradient(180deg, transparent, rgba(10,15,36,.92) 55%); pointer-events: none; }
.auth-pitch { z-index: 2; }
.auth-pitch h1 { font-size: clamp(2rem, 3.6vw, 3.2rem); max-width: 14ch; line-height: 1.08; }
.auth-pitch p { margin-top: 14px; max-width: 46ch; color: var(--haze); }
.auth-stats { display: flex; gap: 36px; margin-top: 28px; }
.auth-stats b { display: block; font-family: var(--display); font-size: 1.5rem; }
.auth-stats span { color: var(--haze); font-size: .85rem; }
.auth-panel { display: grid; place-items: center; padding: 32px; border-left: 1px solid var(--seam); background: rgba(10,15,36,.6); }
.auth-card { width: min(380px, 100%); display: grid; gap: 16px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; background: #0d1430; border: 1px solid var(--seam); border-radius: var(--r-sm); padding: 4px; }
.auth-tabs button { background: none; border: 0; color: var(--haze); font: 600 .9rem var(--ui); padding: .5rem; border-radius: 6px; cursor: pointer; }
.auth-tabs button[aria-selected="true"] { background: var(--hull-2); color: var(--ink); }
.logo { display: inline-flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 1.05rem; color: var(--ink); }
.logo svg { width: 28px; height: 28px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px; padding: 22px 16px; border-right: 1px solid var(--seam); background: rgba(10,15,36,.75); backdrop-filter: blur(10px); }
.side nav { display: grid; gap: 2px; }
.side .group { color: var(--haze); font-size: .78rem; padding: 14px 10px 6px; }
.side a.nav { display: flex; align-items: center; gap: 10px; padding: .55rem .7rem; border-radius: var(--r-sm); color: var(--haze); font-weight: 600; font-size: .92rem; }
.side a.nav:hover { color: var(--ink); background: rgba(255,255,255,.03); text-decoration: none; }
.side a.nav[aria-current="page"] { color: var(--ink); background: var(--hull-2); box-shadow: inset 2px 0 0 var(--signal); }
.side a.nav svg { width: 18px; height: 18px; flex: none; }
.side .foot { margin-top: auto; display: grid; gap: 10px; }
.side .who { font-size: .82rem; color: var(--haze); overflow: hidden; text-overflow: ellipsis; }
.main { min-width: 0; }
.top { display: flex; align-items: center; gap: 14px; padding: 20px 32px; border-bottom: 1px solid var(--seam); position: sticky; top: 0; z-index: 5; background: rgba(10,15,36,.82); backdrop-filter: blur(10px); }
.top h1 { font-size: 1.2rem; }
.top .spacer { flex: 1; }
.chip-balance { display: inline-flex; align-items: baseline; gap: 6px; padding: .45rem .8rem; border: 1px solid var(--seam); border-radius: 999px; font-size: .85rem; color: var(--haze); }
.chip-balance b { font-family: var(--display); color: var(--ink); font-size: .95rem; }
.menu-btn { display: none; }
.page { padding: 28px 32px 60px; display: grid; gap: 22px; max-width: 1360px; }

/* ---------- superfícies ---------- */
.panel { background: linear-gradient(180deg, rgba(24,33,74,.55), rgba(18,25,55,.55)); border: 1px solid var(--seam); border-radius: var(--r-lg); padding: 22px; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.grid { display: grid; gap: 22px; }
.g-hero { grid-template-columns: 1.6fr 1fr; }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-2 { grid-template-columns: 1fr 1fr; }
.g-chart { grid-template-columns: 1.6fr 1fr; }

/* Rede 3D no dashboard */
.network { position: relative; overflow: hidden; min-height: 300px; padding: 0; }
.network .globe { position: absolute; inset: 0 0 0 30%; }
.network .globe canvas { width: 100% !important; height: 100% !important; cursor: grab; }
.network .copy { position: relative; z-index: 1; padding: 24px; max-width: 46%; display: grid; gap: 10px; pointer-events: none; }
.network .copy .big { font-family: var(--display); font-size: 2.6rem; line-height: 1; }
.network .flags { display: flex; flex-wrap: wrap; gap: 6px; }
.flag { font: 600 .74rem var(--ui); padding: 2px 8px; border-radius: 999px; background: rgba(79,209,255,.1); color: var(--signal); border: 1px solid rgba(79,209,255,.25); }
.globe-fallback { background: radial-gradient(circle at 60% 50%, rgba(79,209,255,.25), transparent 55%); }

/* Cartão de saldo 3D */
.wallet-wrap { perspective: 900px; }
.wallet {
  height: 100%; min-height: 300px; border-radius: var(--r-lg); padding: 24px; display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(135deg, #2a2f8f 0%, #5a3fd6 45%, #1d8ec4 100%);
  border: 1px solid rgba(255,255,255,.14); color: #fff; transform-style: preserve-3d;
  transition: transform .25s ease-out; box-shadow: 0 30px 60px -30px rgba(76,64,214,.7);
  position: relative; overflow: hidden;
}
.wallet::after { content: ''; position: absolute; inset: 0; background: radial-gradient(400px 200px at var(--gx, 30%) var(--gy, 20%), rgba(255,255,255,.22), transparent 60%); pointer-events: none; }
.wallet .lbl { opacity: .8; font-size: .85rem; }
.wallet .amt { font-family: var(--display); font-size: 2.6rem; line-height: 1.05; transform: translateZ(40px); }
.wallet .row { display: flex; gap: 10px; transform: translateZ(30px); }
.wallet .btn { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.25); color: #fff; }
.wallet .btn.primary { background: #fff; color: #2a2390; }
.wallet .chipline { display: flex; justify-content: space-between; align-items: center; transform: translateZ(20px); }
.wallet .sim { width: 42px; height: 30px; border-radius: 6px; background: linear-gradient(135deg, #f6d98b, #c9a24a); }

/* Indicadores */
.stat { display: grid; gap: 4px; }
.stat .v { font-family: var(--display); font-size: 1.7rem; font-variant-numeric: tabular-nums; }
.stat .k { color: var(--haze); font-size: .86rem; }
.stat .sub { font-size: .8rem; color: var(--haze); }

/* Gráfico */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: 200px; }
.chart .tip { position: absolute; pointer-events: none; background: #0d1430; border: 1px solid var(--seam); border-radius: 8px; padding: 6px 10px; font-size: .8rem; white-space: nowrap; transform: translate(-50%, -110%); display: none; }
.empty { display: grid; place-items: center; text-align: center; gap: 10px; padding: 36px 16px; color: var(--haze); }

/* Tabelas */
.table-wrap { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th { text-align: left; color: var(--haze); font-weight: 600; font-size: .8rem; padding: 10px 12px; border-bottom: 1px solid var(--seam); white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid rgba(37,48,88,.6); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 600; }
.status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.s-active, .s-approved, .s-available { color: var(--ok); }
.s-pending, .s-assigned { color: var(--warn); }
.s-failed, .s-rejected, .s-dead, .s-banned, .s-refunded { color: var(--bad); }
.s-expired { color: var(--haze); }

/* Produtos */
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 18px; }
.product { display: flex; flex-direction: column; gap: 12px; }
.product .tag { align-self: flex-start; font-size: .74rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.tag.res { background: rgba(139,108,255,.15); color: #b9a8ff; }
.tag.sta { background: rgba(79,209,255,.12); color: var(--signal); }
.product .price { font-family: var(--display); font-size: 1.7rem; }
.product .price small { font: 500 .85rem var(--ui); color: var(--haze); }
.product .buy { margin-top: auto; display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.product .total { font-size: .84rem; color: var(--haze); }
.seg { display: inline-flex; background: #0d1430; border: 1px solid var(--seam); border-radius: var(--r-sm); padding: 3px; }
.seg button { background: none; border: 0; color: var(--haze); font: 600 .84rem var(--ui); padding: .4rem .8rem; border-radius: 6px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--hull-2); color: var(--ink); }

/* Lista de proxies / código */
.code { font-family: var(--mono); font-size: .82rem; background: #0b1129; border: 1px solid var(--seam); border-radius: var(--r-md); padding: 14px; max-height: 360px; overflow: auto; white-space: pre; line-height: 1.7; }
.cred { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.cred div { background: #0b1129; border: 1px solid var(--seam); border-radius: var(--r-sm); padding: 10px 12px; min-width: 0; }
.cred span { display: block; color: var(--haze); font-size: .76rem; }
.cred b { font-family: var(--mono); font-weight: 500; font-size: .86rem; word-break: break-all; }
.meter { height: 10px; background: #0b1129; border-radius: 99px; overflow: hidden; border: 1px solid var(--seam); }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--ion), var(--signal)); border-radius: 99px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }

/* Modal */
dialog { background: var(--hull); color: var(--ink); border: 1px solid var(--seam); border-radius: var(--r-lg); padding: 0; width: min(560px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(5,8,20,.7); backdrop-filter: blur(4px); }
dialog form { padding: 24px; display: grid; gap: 14px; }
dialog .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
dialog[open] { animation: pop .18s ease-out; }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }

/* Toasts */
#toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 10px; z-index: 100; }
.toast { background: var(--hull-2); border: 1px solid var(--seam); border-left: 3px solid var(--signal); padding: 12px 16px; border-radius: var(--r-sm); max-width: 360px; font-size: .9rem; box-shadow: 0 16px 40px -16px #000; }
.toast.err { border-left-color: var(--bad); }
.toast.ok { border-left-color: var(--ok); }

/* Responsivo */
@media (max-width: 1100px) {
  .g-hero, .g-chart { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-visual { min-height: 46vh; padding: 24px 16px; }
  .auth-visual .globe { opacity: .45; }
  .auth-panel { border-left: 0; border-top: 1px solid var(--seam); padding: 24px 16px; }
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 20; inset: 0 auto 0 0; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .top { padding: 14px 16px; }
  .top .chip-balance { display: none; }
  .page { padding: 18px 16px 48px; }
  .g-3, .g-2 { grid-template-columns: 1fr; }
  .network .globe { inset: 30% 0 0 0; }
  .network .copy { max-width: 100%; }
  .network { min-height: 420px; }
  .panel { padding: 18px; }
  .table-wrap { margin: 0 -18px; padding: 0 18px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

.cred.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat.top { align-content: start; }
@media (max-width: 560px) { .cred.two { grid-template-columns: 1fr; } }
