/* reseller/reseller.css — DS isolado do painel do revendedor.
   Tokens espelham o nativeUI (dark/roxo/glass) mas a página é independente. */
:root {
  --rs-bg: #09090B;
  --rs-card: #12121A;
  --rs-card2: #16161F;
  --rs-purple: #7C3AED;
  --rs-purple-h: #8B5CF6;
  --rs-text: #F8FAFC;
  --rs-text2: #94A3B8;
  --rs-border: rgba(255, 255, 255, 0.08);
  --rs-ok: #22C55E;
  --rs-warn: #F59E0B;
  --rs-danger: #EF4444;
  --rs-radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--rs-bg);
  color: var(--rs-text);
  font-family: "Inter", -apple-system, "SF Pro", "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* Gate / Denied */
/* [hidden] precisa vencer o display:flex abaixo — sem isto, o atributo hidden
   do JS (show()) não esconde o gate e o spinner "Verificando acesso…" fica
   sobreposto ao app mesmo após a validação concluir. */
[hidden] { display: none !important; }
.rs-gate, .rs-denied {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px; color: var(--rs-text2);
}
.rs-spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--rs-border); border-top-color: var(--rs-purple);
  animation: rs-spin 0.8s linear infinite;
}
@keyframes rs-spin { to { transform: rotate(360deg); } }
.rs-denied-card {
  background: var(--rs-card); border: 1px solid var(--rs-border);
  border-radius: var(--rs-radius); padding: 40px; text-align: center; max-width: 380px;
}
.rs-denied-ico { font-size: 40px; margin-bottom: 12px; }
.rs-denied-card h1 { font-size: 20px; margin-bottom: 8px; }
.rs-denied-card p { color: var(--rs-text2); }

/* App shell */
.rs-app { max-width: 1100px; margin: 0 auto; padding: 28px 24px 60px; }
.rs-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 6px;
}
.rs-head-left { display: flex; align-items: center; gap: 14px; }
.rs-logo {
  width: 44px; height: 44px; border-radius: 12px; font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--rs-purple), var(--rs-purple-h));
}
.rs-head-title { font-size: 18px; font-weight: 700; }
.rs-head-sub { color: var(--rs-text2); font-size: 13px; }
.rs-head-right { display: flex; align-items: center; gap: 14px; }
.rs-balance { text-align: right; }
.rs-balance-label { display: block; color: var(--rs-text2); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.rs-balance-val { font-size: 18px; font-weight: 700; color: var(--rs-purple-h); }
.rs-updated { color: var(--rs-text2); font-size: 12px; margin-bottom: 20px; }
/* Dashboard grid */
.rs-dash {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px; margin-bottom: 26px;
}
.rs-card {
  background: var(--rs-card); border: 1px solid var(--rs-border);
  border-radius: var(--rs-radius); padding: 16px 18px;
  backdrop-filter: blur(8px);
}
.rs-card-label { color: var(--rs-text2); font-size: 12px; margin-bottom: 8px; }
.rs-card-val { font-size: 22px; font-weight: 700; }
.rs-card-accent { border-color: rgba(124, 58, 237, 0.5); }
.rs-card-accent .rs-card-val { color: var(--rs-purple-h); }
.rs-card-profit .rs-card-val { color: var(--rs-ok); }

/* Action bar */
.rs-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.rs-search {
  flex: 1; min-width: 220px;
  background: var(--rs-card); border: 1px solid var(--rs-border); color: var(--rs-text);
  border-radius: 10px; padding: 10px 14px; font-size: 14px; outline: none;
}
.rs-search:focus { border-color: var(--rs-purple); }
.rs-filters { display: flex; gap: 8px; }
.rs-chip {
  background: var(--rs-card); border: 1px solid var(--rs-border); color: var(--rs-text2);
  border-radius: 999px; padding: 8px 16px; font-size: 13px; cursor: pointer;
  transition: all 0.15s;
}
.rs-chip:hover { color: var(--rs-text); }
.rs-chip-on { background: var(--rs-purple); border-color: var(--rs-purple); color: #fff; }

/* Buttons */
.rs-btn {
  border: 1px solid var(--rs-border); border-radius: 10px; padding: 10px 18px;
  font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.15s;
  background: var(--rs-card); color: var(--rs-text);
}
.rs-btn-primary { background: var(--rs-purple); border-color: var(--rs-purple); color: #fff; }
.rs-btn-primary:hover { background: var(--rs-purple-h); }
.rs-btn-ghost:hover { border-color: var(--rs-purple); color: var(--rs-purple-h); }
.rs-btn-danger { background: var(--rs-danger); border-color: var(--rs-danger); color: #fff; }
.rs-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* Table */
.rs-table-wrap {
  background: var(--rs-card); border: 1px solid var(--rs-border);
  border-radius: var(--rs-radius); overflow: hidden;
}
.rs-table { width: 100%; border-collapse: collapse; }
.rs-table th {
  text-align: left; padding: 14px 16px; font-size: 12px; color: var(--rs-text2);
  text-transform: uppercase; letter-spacing: 0.03em; border-bottom: 1px solid var(--rs-border);
}
.rs-table td { padding: 14px 16px; border-bottom: 1px solid var(--rs-border); font-size: 13px; }
.rs-table tr:last-child td { border-bottom: none; }
.rs-key-cell code { font-size: 12px; color: var(--rs-purple-h); }
.rs-empty { padding: 40px; text-align: center; color: var(--rs-text2); }
.rs-actions { display: flex; gap: 8px; }
.rs-icon-btn {
  background: var(--rs-card2); border: 1px solid var(--rs-border); color: var(--rs-text2);
  border-radius: 8px; width: 32px; height: 32px; cursor: pointer; font-size: 14px;
}
.rs-icon-btn:hover { color: var(--rs-text); border-color: var(--rs-purple); }
.rs-icon-danger:hover { color: var(--rs-danger); border-color: var(--rs-danger); }

/* Pills */
.rs-pill { padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.rs-pill-ok { background: rgba(34, 197, 94, 0.15); color: var(--rs-ok); }
.rs-pill-warn { background: rgba(245, 158, 11, 0.15); color: var(--rs-warn); }
.rs-pill-danger { background: rgba(239, 68, 68, 0.15); color: var(--rs-danger); }
/* Modal */
.rs-modal-ov {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px; animation: rs-fade 0.15s ease;
}
@keyframes rs-fade { from { opacity: 0; } to { opacity: 1; } }
.rs-modal {
  background: var(--rs-card); border: 1px solid var(--rs-border);
  border-radius: var(--rs-radius); width: 100%; max-width: 460px;
  padding: 24px; animation: rs-pop 0.18s ease;
  max-height: 88vh; overflow-y: auto;
}
.rs-modal-wide { max-width: 820px; }
@keyframes rs-pop { from { transform: scale(0.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.rs-modal-title { font-size: 18px; margin-bottom: 16px; }
.rs-modal-body { margin-bottom: 20px; color: var(--rs-text2); }
.rs-modal-body strong { color: var(--rs-text); }
.rs-modal-foot { display: flex; justify-content: flex-end; gap: 10px; }

/* Plan options */
.rs-plans { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.rs-plan-opt {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--rs-card2); border: 1px solid var(--rs-border);
  border-radius: 10px; cursor: pointer;
}
.rs-plan-opt:hover { border-color: var(--rs-purple); }
.rs-plan-name { flex: 1; color: var(--rs-text); }
.rs-plan-cost { font-weight: 700; color: var(--rs-purple-h); }
.rs-warn { color: var(--rs-warn); }

/* Inputs */
.rs-customer { display: flex; flex-direction: column; gap: 14px; }
.rs-label { display: flex; flex-direction: column; gap: 6px; color: var(--rs-text2); font-size: 13px; }
.rs-input {
  width: 100%; min-width: 0; display: block;
  background: var(--rs-card2); border: 1px solid var(--rs-border); color: var(--rs-text);
  border-radius: 10px; padding: 11px 14px; font-size: 14px; outline: none;
}
.rs-input:focus { border-color: var(--rs-purple); }
select.rs-input { cursor: pointer; text-overflow: ellipsis; }

/* Create modal: grid de formulário + resumo de lucro.
   minmax(0,1fr) impede que o texto longo do <select> estoure a coluna
   (sem isso o track 1fr usa min-content e deixa o formulário torto). */
.rs-form-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px; margin-bottom: 16px;
}
.rs-form-grid .rs-label { min-width: 0; }
.rs-summary {
  background: var(--rs-card2); border: 1px solid var(--rs-border);
  border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px;
}
.rs-summary-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--rs-text2); }
.rs-summary-row strong { color: var(--rs-text); }
.rs-summary-profit {
  border-top: 1px solid var(--rs-border); padding-top: 8px; margin-top: 2px; font-size: 15px;
}
.rs-summary-profit strong { color: var(--rs-ok); font-weight: 700; }
.rs-summary-profit strong.rs-neg { color: var(--rs-danger); }

/* Select de filtro na barra de ações */
.rs-select {
  background: var(--rs-card); border: 1px solid var(--rs-border); color: var(--rs-text);
  border-radius: 10px; padding: 10px 12px; font-size: 13px; outline: none; cursor: pointer;
}
.rs-select:focus { border-color: var(--rs-purple); }

/* Card largo (última venda) + subtítulo */
.rs-card-wide { grid-column: span 2; }
.rs-card-sub { display: block; color: var(--rs-text2); font-size: 12px; font-weight: 400; margin-top: 2px; }
.rs-card-wide .rs-card-val { font-size: 16px; line-height: 1.4; }

/* Células numéricas da tabela */
.rs-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Generated key box */
.rs-keybox {
  display: flex; align-items: center; gap: 10px; margin: 14px 0;
  background: var(--rs-card2); border: 1px solid var(--rs-border);
  border-radius: 10px; padding: 12px 14px;
}
.rs-keybox code { flex: 1; color: var(--rs-purple-h); font-size: 14px; word-break: break-all; }
.rs-keyexp { color: var(--rs-text2); font-size: 13px; }

/* Modal de Integração / API */
.rs-api-step { color: var(--rs-text); font-size: 13px; margin: 10px 0 6px; }
.rs-api-note { color: var(--rs-text2); font-size: 12px; line-height: 1.6; margin: 10px 0 0; }
.rs-api-note code, .rs-api-step code {
  background: var(--rs-card2); border: 1px solid var(--rs-border);
  border-radius: 5px; padding: 1px 5px; color: var(--rs-purple-h); font-size: 12px;
}
.rs-api-code {
  background: #0b0b13; border: 1px solid var(--rs-border); border-radius: 10px;
  padding: 14px; margin: 8px 0 4px; overflow-x: auto;
  max-height: 260px; overflow-y: auto;
}
.rs-api-code code {
  color: var(--rs-text); font-size: 12px; line-height: 1.5;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre; word-break: normal;
}
.rs-api-keyout { margin-top: 14px; }
.rs-api-promptbox {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.18), rgba(124, 58, 237, 0.06));
  border: 1px solid var(--rs-purple); border-radius: 12px;
  padding: 14px 16px; margin: 14px 0;
}
.rs-api-promptbox-txt { flex: 1; min-width: 220px; font-size: 13px; color: var(--rs-text); line-height: 1.5; }
.rs-api-promptbox button { white-space: nowrap; }
.rs-api-promptbox-tag {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
  color: var(--rs-purple-h); background: rgba(124, 58, 237, 0.18);
  border-radius: 5px; padding: 2px 7px; margin-bottom: 6px; text-transform: uppercase;
}
.rs-api-steps { margin: 14px 0; padding-left: 20px; color: var(--rs-text); font-size: 13px; line-height: 1.7; }
.rs-api-steps li { margin-bottom: 4px; }
.rs-api-rules {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; margin: 16px 0;
  background: var(--rs-card2); border: 1px solid var(--rs-border);
  border-radius: 10px; padding: 14px 16px;
  font-size: 12.5px; color: var(--rs-text2); line-height: 1.5;
}
@media (max-width: 620px) { .rs-api-rules { grid-template-columns: 1fr; } }
.rs-api-rules strong { color: var(--rs-text); }
.rs-api-details { margin: 14px 0; border: 1px solid var(--rs-border); border-radius: 10px; overflow: hidden; }
.rs-api-details summary {
  cursor: pointer; padding: 12px 14px; font-size: 13px; font-weight: 600;
  color: var(--rs-text); background: var(--rs-card2); user-select: none;
}
.rs-api-details summary:hover { color: var(--rs-purple-h); }
.rs-api-details[open] summary { border-bottom: 1px solid var(--rs-border); }
.rs-api-details > *:not(summary) { padding-left: 14px; padding-right: 14px; }
.rs-api-plans { margin: 14px 0 4px; }
.rs-api-plantable { font-size: 12px; }
.rs-api-plantable td, .rs-api-plantable th { padding: 6px 8px; }
.rs-plan-id { color: var(--rs-purple-h); font-size: 12px; white-space: nowrap; margin-right: 8px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.rs-api-plantable td:last-child { white-space: nowrap; }
.rs-api-plantable td, .rs-api-plantable th { vertical-align: middle; }

/* Recarga: grid de pacotes fixos */
.rs-pack-hint { color: var(--rs-text2); font-size: 13px; margin: 0 0 14px; }
.rs-pack-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.rs-pack {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--rs-card2); border: 1px solid var(--rs-border);
  border-radius: 14px; padding: 16px 12px; cursor: pointer; color: var(--rs-text);
  transition: border-color 0.15s ease, transform 0.1s ease, background 0.15s ease;
}
.rs-pack:hover { border-color: var(--rs-purple); background: var(--rs-card); transform: translateY(-2px); }
.rs-pack-credits { font-size: 17px; font-weight: 700; color: var(--rs-purple-h); }
.rs-pack-bonus { font-size: 11px; font-weight: 600; color: var(--rs-ok); }
.rs-pack-name { font-size: 12px; color: var(--rs-text2); text-align: center; }
.rs-pack-price { font-size: 15px; font-weight: 600; margin-top: 4px; }

/* Recarga: loading + view Pix */
.rs-rc-loading { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 24px 0; color: var(--rs-text2); }
.rs-rc-sub { text-align: center; color: var(--rs-text2); font-size: 13px; margin: 0 0 10px; }
.rs-qr { width: 200px; height: 200px; display: block; margin: 10px auto;
  border-radius: 10px; background: #fff; padding: 8px; box-sizing: border-box; }
.rs-rc-label { color: var(--rs-text2); font-size: 12px; margin: 8px 0 4px; }
.rs-rc-code {
  width: 100%; height: 64px; box-sizing: border-box; resize: none;
  background: var(--rs-card2); border: 1px solid var(--rs-border);
  border-radius: 8px; color: var(--rs-purple-h); font-size: 11px; padding: 8px;
}
.rs-rc-status { margin-top: 12px; text-align: center; color: var(--rs-text2); font-size: 13px; }
.rs-rc-status.rs-rc-ok { color: var(--rs-ok); }
.rs-rc-status.rs-rc-err { color: var(--rs-danger); }

/* Toasts */
.rs-toasts {
  position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column;
  gap: 10px; z-index: 2000;
}
.rs-toast {
  background: var(--rs-card); border: 1px solid var(--rs-border); color: var(--rs-text);
  border-radius: 10px; padding: 13px 18px; font-size: 14px; min-width: 200px;
  opacity: 0; transform: translateX(20px); transition: all 0.3s ease;
  border-left: 3px solid var(--rs-purple);
}
.rs-toast-in { opacity: 1; transform: translateX(0); }
.rs-toast-ok { border-left-color: var(--rs-ok); }
.rs-toast-err { border-left-color: var(--rs-danger); }

/* Responsivo */
@media (max-width: 720px) {
  .rs-head { flex-direction: column; align-items: flex-start; }
  .rs-table-wrap { overflow-x: auto; }
  .rs-bar { flex-direction: column; align-items: stretch; }
  .rs-form-grid { grid-template-columns: 1fr; }
  .rs-card-wide { grid-column: span 1; }
}
