/* =========================================================================
   MaimbeBot — app.css
   Identidade: dark hacker / cyberpunk. Preto-grafite (void) como base,
   VERMELHO (#FF2A3D) como comando/destaque, verde-terminal só de apoio.
   Tipos: Chakra Petch (display), Inter (corpo), JetBrains Mono (dados).
   Ver BRAND_GUIDE.md. Dark-first, mobile-first, foco visível, reduced-motion.
   ========================================================================= */

:root {
  /* base */
  --void:     #0A0B0F;
  --panel:    #14161D;
  --panel-2:  #1a1d26;
  --graphite: #1F232D;
  --line:     rgba(255, 255, 255, .06);
  --line-2:   rgba(255, 255, 255, .12);

  /* comando */
  --red:      #FF2A3D;
  --red-deep: #C20E24;
  --red-soft: rgba(255, 42, 61, .12);
  --red-ink:  #120103;

  /* estados */
  --term:      #3DF06B;
  --term-soft: rgba(61, 240, 107, .12);
  --amber:     #F5B331;
  --amber-soft: rgba(245, 179, 49, .12);

  /* tinta */
  --ink:      #E9ECF2;
  --dim:      #8B93A3;
  --faint:    #5A6172;

  /* forma / tipos */
  --r:    14px;
  --r-sm: 9px;
  --pad:  18px;
  --shadow: 0 12px 34px rgba(0, 0, 0, .45);
  --disp: "Chakra Petch", "Rajdhani", "Segoe UI", sans-serif;
  --body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background:
    radial-gradient(900px 480px at 82% -8%, rgba(255, 42, 61, .10), transparent 60%),
    radial-gradient(700px 400px at -8% 0%, rgba(120, 130, 150, .05), transparent 55%),
    var(--void);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15.5px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
/* scanlines HUD sutis */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.02) 0 1px, transparent 1px 4px);
  mix-blend-mode: overlay;
}
body > * { position: relative; z-index: 1; }

a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; border-radius: 4px; }

/* ===================== Topbar ===================== */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 16px;
  padding: 12px clamp(14px, 4vw, 28px);
  background: rgba(20, 22, 29, .82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--graphite);
  box-shadow: 0 1px 0 rgba(255, 42, 61, .35);
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--disp); font-weight: 700; letter-spacing: .5px; font-size: 1.14rem; color: var(--ink); }
.brand .mark {
  width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--panel); border: 1px solid rgba(255, 42, 61, .4);
  color: var(--red); font-weight: 700; font-family: var(--mono);
  box-shadow: 0 0 14px rgba(255, 42, 61, .25);
}
.brand b { color: var(--red); }
.nav { display: flex; gap: 4px; margin-left: 8px; flex-wrap: wrap; }
.nav a { color: var(--dim); padding: 7px 12px; border-radius: 8px; font-size: .92rem; font-weight: 600; }
.nav a:hover { color: var(--ink); background: var(--graphite); text-decoration: none; }
.nav a.on { color: var(--red); background: var(--red-soft); }
.topbar .spacer { flex: 1; }
.topbar .who { color: var(--dim); font-size: .84rem; font-family: var(--mono); }
.topbar .who b { color: var(--ink); font-weight: 600; }

/* ===================== Layout ===================== */
.wrap { max-width: 1080px; margin: 0 auto; padding: clamp(18px, 4vw, 32px); }
.page-head { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .spacer { flex: 1; }
.eyebrow { text-transform: uppercase; letter-spacing: .22em; font-size: .70rem; font-weight: 600; color: var(--faint); font-family: var(--mono); }
h1 { font-family: var(--disp); font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 700; letter-spacing: .5px; margin: 3px 0 0; }
h2 { font-family: var(--disp); font-size: 1.18rem; font-weight: 600; margin: 0 0 12px; letter-spacing: .3px; }
.sub { color: var(--dim); margin: 4px 0 0; }

/* ===================== Cards ===================== */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card {
  background: linear-gradient(180deg, var(--panel), var(--void));
  border: 1px solid var(--graphite); border-radius: var(--r);
  padding: var(--pad); box-shadow: var(--shadow);
}
.card.link { cursor: pointer; transition: transform .12s ease, border-color .12s ease; }
.card.link:hover { transform: translateY(-2px); border-color: rgba(255, 42, 61, .45); }

.acc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.acc-head .name { font-weight: 700; font-size: 1.05rem; }
.acc-head .igg { color: var(--faint); font-family: var(--mono); font-size: .74rem; }

.kv { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; font-size: .92rem; }
.kv .k { color: var(--dim); }
.kv .v { font-weight: 600; }
.kv .v.mono { font-family: var(--mono); }

/* ===================== Status pills ===================== */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; border: 1px solid transparent; white-space: nowrap; font-family: var(--mono); }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.live    { color: var(--term);  background: var(--term-soft);  border-color: rgba(61,240,107,.3); }
.pill.stopped { color: var(--dim);   background: var(--graphite); }
.pill.warn    { color: var(--amber); background: var(--amber-soft); }
.pill.danger  { color: var(--red);   background: var(--red-soft);   border-color: rgba(255,42,61,.35); }
.pill.pending { color: var(--amber); background: var(--amber-soft); }
.pill.live .dot, .pill.danger .dot { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

/* ===================== Botões ===================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: var(--r-sm);
  font-family: var(--body); font-size: .92rem; font-weight: 700;
  border: 1px solid var(--line-2); background: var(--graphite); color: var(--ink);
  cursor: pointer; transition: filter .12s ease, transform .05s ease, box-shadow .15s ease;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.15); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--red); color: var(--red-ink); border-color: transparent; }
.btn.primary:hover { box-shadow: 0 0 22px rgba(255, 42, 61, .45); }
.btn.live   { background: var(--term); color: #05231a; border-color: transparent; }
.btn.danger { background: transparent; color: var(--red); border-color: rgba(255,42,61,.4); }
.btn.ghost  { background: transparent; }
.btn.sm     { padding: 7px 11px; font-size: .84rem; }
.btn.block  { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===================== Formulários ===================== */
.field { margin-bottom: 14px; }
label.lbl { display: block; font-size: .82rem; color: var(--dim); margin-bottom: 6px; font-weight: 600; font-family: var(--mono); letter-spacing: .02em; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=tel], select, textarea {
  width: 100%; padding: 11px 13px; border-radius: var(--r-sm);
  background: var(--void); border: 1px solid var(--line-2); color: var(--ink);
  font-family: var(--body); font-size: .95rem;
}
input:focus, select:focus, textarea:focus { border-color: var(--red); outline: none; box-shadow: 0 0 0 3px var(--red-soft); }
input::placeholder { color: var(--faint); }

/* ===================== Auth ===================== */
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-logo { display: block; width: min(220px, 72vw); height: auto; margin: -8px auto 10px; filter: drop-shadow(0 0 24px rgba(255, 42, 61, .18)); }
.auth-card .brand { justify-content: center; font-size: 1.5rem; margin-bottom: 6px; }
.auth-card .sub { text-align: center; margin-bottom: 22px; }
.auth-card .swap { text-align: center; margin-top: 16px; color: var(--dim); font-size: .9rem; }

/* opt-in checkbox + hint */
.check-row { display: flex; align-items: flex-start; gap: 9px; color: var(--ink); font-size: .9rem; line-height: 1.35; margin: 8px 0; cursor: pointer; }
.check-row input { margin-top: 3px; accent-color: var(--red); }
.hint { color: var(--faint); font-size: .78rem; margin: -2px 0 14px; }

/* seletor de país + telefone */
.phone-field { display: flex; gap: 8px; align-items: stretch; }
.phone-field input { flex: 1; min-width: 0; }
.phone-cc {
  display: flex; align-items: center; gap: 7px;
  background: var(--void); border: 1px solid var(--line-2); border-radius: var(--r-sm);
  padding: 0 11px; color: var(--ink); cursor: pointer; white-space: nowrap;
  font-family: var(--body); font-size: .92rem; font-variant-numeric: tabular-nums;
}
.phone-cc:hover { border-color: var(--line-2); filter: brightness(1.2); }
.phone-cc .flag svg, .phone-menu .flag svg { width: 22px; height: 15px; border-radius: 2px; display: block; box-shadow: 0 0 0 1px rgba(255,255,255,.08); }
.phone-cc .flag { display: flex; }
.phone-cc .car { color: var(--dim); font-size: .7rem; }
.phone-menu {
  position: absolute; z-index: 60; top: calc(100% + 4px); left: 0;
  width: 280px; max-width: 90vw; max-height: 280px; overflow: auto;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-sm);
  box-shadow: var(--shadow);
}
.phone-menu .phone-search { position: sticky; top: 0; background: var(--panel); padding: 8px; border-bottom: 1px solid var(--line); }
.phone-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: none; border: none; color: var(--ink); padding: 9px 12px; cursor: pointer;
  font-family: var(--body); font-size: .9rem;
}
.phone-menu button:hover { background: var(--graphite); }
.phone-menu .flag { display: flex; }
.phone-menu .dial { margin-left: auto; color: var(--dim); font-family: var(--mono); font-size: .82rem; }

/* ===================== Mensagens ===================== */
.msg { min-height: 20px; font-size: .9rem; margin: 8px 0; font-family: var(--mono); }
.msg.ok  { color: var(--term); }
.msg.err { color: var(--red); }
.banner { padding: 12px 14px; border-radius: var(--r-sm); font-size: .92rem; border: 1px solid var(--line-2); background: var(--panel); }
.banner.ok     { border-color: rgba(61,240,107,.4); background: var(--term-soft);  color: var(--term); }
.banner.warn   { border-color: rgba(245,179,49,.4); background: var(--amber-soft); color: var(--amber); }
.banner.danger { border-color: rgba(255,42,61,.4);  background: var(--red-soft);   color: var(--red); }

/* ===================== Painel de dados ===================== */
.panel-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.stat { background: var(--void); border: 1px solid var(--graphite); border-radius: var(--r-sm); padding: 14px 16px; }
.stat .lab { text-transform: uppercase; letter-spacing: .1em; font-size: .66rem; color: var(--faint); font-weight: 600; font-family: var(--mono); }
.stat .num { font-family: var(--disp); font-size: 1.4rem; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.live-tag { display: inline-flex; align-items: center; gap: 6px; color: var(--term); font-size: .76rem; font-weight: 700; font-family: var(--mono); }
.live-tag .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--term); animation: pulse 1.8s ease-in-out infinite; }

.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.feed li:last-child { border-bottom: none; }
.feed .t { color: var(--faint); font-family: var(--mono); font-size: .8rem; min-width: 48px; }

/* ===================== Abas (config) ===================== */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--graphite); margin-bottom: 18px; }
.tab { padding: 9px 15px; border: none; background: none; color: var(--dim); font-family: var(--body); font-size: .92rem; font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; border-radius: 6px 6px 0 0; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--red); border-bottom-color: var(--red); }

.cfg-group { display: grid; gap: 2px; }
.cfg-row { display: flex; align-items: center; gap: 14px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.cfg-row:last-child { border-bottom: none; }
.cfg-row .cfg-lbl { flex: 1; }
.cfg-row .cfg-lbl .name { font-weight: 600; }
.cfg-row .cfg-lbl .hint { color: var(--faint); font-size: .8rem; }
.cfg-row .cfg-ctl { flex-shrink: 0; }
.cfg-row .cfg-ctl input[type=number], .cfg-row .cfg-ctl input[type=text], .cfg-row .cfg-ctl select { width: 150px; }

/* toggle */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; cursor: pointer; border-radius: 999px; background: var(--graphite); border: 1px solid var(--line-2); transition: .18s; }
.switch .slider::before { content: ""; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px; background: var(--dim); border-radius: 50%; transition: .18s; }
.switch input:checked + .slider { background: var(--term-soft); border-color: var(--term); }
.switch input:checked + .slider::before { transform: translateX(20px); background: var(--term); }
.switch input:focus-visible + .slider { outline: 2px solid var(--red); outline-offset: 2px; }

.save-bar { position: sticky; bottom: 0; margin-top: 18px; padding: 14px 0; display: flex; align-items: center; gap: 12px; background: linear-gradient(0deg, var(--void), transparent); }

/* ===================== Tabelas ===================== */
.table-wrap { overflow-x: auto; border: 1px solid var(--graphite); border-radius: var(--r); }
table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 480px; }
table.tbl th, table.tbl td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); }
table.tbl th { color: var(--dim); font-weight: 600; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; font-family: var(--mono); }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl td.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); }
.cred { color: var(--term); }
.deb  { color: var(--red); }

/* ===================== Carteira ===================== */
.saldo-hero { background: linear-gradient(150deg, var(--panel), var(--void)); border: 1px solid rgba(255,42,61,.25); border-radius: var(--r); padding: 24px; margin-bottom: 20px; }
.saldo-hero .lab { color: var(--dim); text-transform: uppercase; letter-spacing: .12em; font-size: .7rem; font-weight: 600; font-family: var(--mono); }
.saldo-hero .val { font-family: var(--disp); font-size: clamp(2rem, 6vw, 2.8rem); font-weight: 700; color: var(--red); letter-spacing: .5px; }

.plan-card { text-align: center; }
.plan-card .price { font-family: var(--disp); font-size: 1.8rem; font-weight: 700; margin: 6px 0; }
.plan-card .bonus { color: var(--term); font-size: .85rem; font-weight: 700; font-family: var(--mono); }

/* ===================== util ===================== */
.muted { color: var(--dim); }
.center { text-align: center; }
.mt { margin-top: 16px; } .mt2 { margin-top: 26px; }
.hidden { display: none !important; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line-2); border-top-color: var(--red); border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 48px 20px; color: var(--dim); }
.empty .big { font-size: 2.4rem; margin-bottom: 8px; }

/* ===================== responsivo ===================== */
@media (max-width: 620px) {
  .topbar { gap: 8px; }
  .cfg-row { flex-wrap: wrap; }
  .cfg-row .cfg-ctl input, .cfg-row .cfg-ctl select { width: 120px !important; }
}

/* ===================== steps (tutorial numerado) ===================== */
.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; display: grid; gap: 12px; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: start; font-size: .92rem; line-height: 1.5; }
.steps li::before {
  content: counter(step); display: grid; place-items: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--red-soft); color: var(--red); border: 1px solid rgba(255,42,61,.4);
  font-weight: 700; font-family: var(--mono); font-size: .82rem;
}
.steps li b { color: var(--ink); }
.steps .mono { font-family: var(--mono); background: var(--void); padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line-2); font-size: .85em; white-space: nowrap; }
.steps .sub2 { color: var(--faint); font-size: .82rem; }

/* ===================== toast ===================== */
.toast-wrap { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: 92vw; }
.toast {
  background: var(--panel); border: 1px solid var(--line-2); border-left: 3px solid var(--dim);
  color: var(--ink); padding: 12px 16px; border-radius: var(--r-sm); box-shadow: var(--shadow);
  font-size: .9rem; opacity: 0; transform: translateY(10px); transition: opacity .2s, transform .2s;
}
.toast.in { opacity: 1; transform: translateY(0); }
.toast.ok  { border-left-color: var(--term); }
.toast.err { border-left-color: var(--red); }

/* ===================== modal ===================== */
.modal-back { position: fixed; inset: 0; z-index: 210; background: rgba(0,0,0,.6); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 20px; }
.modal-card { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r); padding: 22px; max-width: 420px; width: 100%; box-shadow: var(--shadow); }
.modal-card p { margin: 0; }

/* ===================== reduced motion ===================== */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  body::before { display: none; }
}
