:root {
  color-scheme: dark;
  --bg: #07110e;
  --surface: rgba(13, 29, 24, 0.92);
  --surface-2: #122b23;
  --line: rgba(144, 238, 189, 0.17);
  --text: #f3fff9;
  --muted: #9bb8aa;
  --primary: #47e69a;
  --primary-strong: #1bcf7a;
  --danger: #ff8b8b;
  --warn: #ffd27a;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 12%, rgba(40, 208, 129, 0.14), transparent 34rem),
    radial-gradient(circle at 88% 90%, rgba(40, 208, 129, 0.09), transparent 30rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell { min-height: 100vh; display: grid; place-items: center; padding: 28px 16px; }

.card {
  width: min(100%, 480px);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.brand-mark {
  width: 54px; height: 54px; display: grid; place-items: center; margin-bottom: 24px;
  border-radius: 17px; color: #062215; background: linear-gradient(135deg, #83ffc1, var(--primary));
  font-size: 22px; font-weight: 900; box-shadow: 0 10px 28px rgba(71, 230, 154, 0.23);
}
.brand-mark.alerta { background: linear-gradient(135deg, #ffc9c9, var(--danger)); box-shadow: none; }
.brand-mark.espera { background: linear-gradient(135deg, #ffe7b3, var(--warn)); box-shadow: none; }

.eyebrow { margin: 0 0 8px; color: var(--primary); font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(26px, 7vw, 34px); line-height: 1.1; letter-spacing: -.04em; }
h2 { margin: 0 0 14px; font-size: 20px; letter-spacing: -.02em; }
.lead { margin: 12px 0 24px; color: var(--muted); line-height: 1.55; }
.heading-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }

form { display: grid; gap: 10px; }
label { margin-top: 6px; color: #dcebe3; font-size: 14px; font-weight: 700; }

input, select, textarea {
  width: 100%; min-height: 52px; border: 1px solid var(--line); border-radius: 14px; outline: none;
  background: rgba(5, 17, 13, 0.75); color: var(--text); font: inherit; font-size: 16px; padding: 0 14px;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
select option { background: #0b1a15; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(71, 230, 154, .11); background-color: #091c15; }
input::placeholder { color: #607b6e; }
input[type="checkbox"] { width: 20px; min-height: 20px; height: 20px; padding: 0; accent-color: var(--primary); }

.phone-row { display: grid; grid-template-columns: minmax(0, 172px) minmax(0, 1fr); gap: 8px; }

button { font: inherit; cursor: pointer; }
.primary-button {
  min-height: 54px; margin-top: 12px; padding: 0 20px; border: 0; border-radius: 15px; color: #042016;
  background: linear-gradient(135deg, #7affbb, var(--primary-strong)); font-weight: 850;
  box-shadow: 0 14px 32px rgba(27, 207, 122, .18); transition: transform .18s, filter .18s;
}
.primary-button:hover { transform: translateY(-1px); filter: brightness(1.05); }
.primary-button:disabled { cursor: not-allowed; opacity: .55; transform: none; }
.full { width: 100%; }
.secondary-button { min-height: 44px; padding: 0 16px; border: 1px solid var(--line); border-radius: 13px; background: transparent; color: var(--text); font-weight: 700; }
.secondary-button:hover { border-color: var(--primary); }
.danger-button { min-height: 44px; padding: 0 16px; border: 1px solid rgba(255, 139, 139, .35); border-radius: 13px; background: transparent; color: var(--danger); font-weight: 700; }
.link-button { border: 0; background: transparent; color: var(--muted); font-size: 14px; padding: 4px 0; }
.link-button:hover { color: var(--text); }
a { color: var(--primary); }
.hint { margin: 2px 0 0; color: #769486; font-size: 13px; line-height: 1.45; }
.center { text-align: center; }
.footer-links { margin-top: 20px; text-align: center; color: var(--muted); font-size: 14px; }

.message { margin: 16px 0 0; padding: 12px 14px; border: 1px solid rgba(255, 139, 139, .25); border-radius: 13px; background: rgba(255, 90, 90, .08); color: var(--danger); font-size: 14px; line-height: 1.45; }
.notice { margin: 16px 0 0; padding: 12px 14px; border: 1px solid rgba(71, 230, 154, .25); border-radius: 13px; background: rgba(71, 230, 154, .07); color: var(--text); font-size: 14px; line-height: 1.45; }

/* recarga */
.stepper { display: grid; grid-template-columns: 54px 1fr 54px; gap: 8px; }
.stepper button { border: 1px solid var(--line); border-radius: 14px; background: rgba(5, 17, 13, 0.75); color: var(--primary); font-size: 24px; font-weight: 700; }
.stepper input { text-align: center; font-size: 22px; font-weight: 800; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.chip { min-height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 700; }
.chip:hover { color: var(--text); border-color: var(--primary); }
.tiers { width: 100%; margin: 6px 0 0; border-collapse: collapse; font-size: 14px; }
.tiers td { padding: 7px 0; border-bottom: 1px solid var(--line); color: var(--muted); }
.tiers td:last-child { text-align: right; color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.tiers tr.ativa td { color: var(--primary); }
.breakdown { margin: 18px 0 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; background: rgba(5, 17, 13, 0.55); }
.breakdown div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; }
.breakdown div.total { margin-top: 6px; padding-top: 11px; border-top: 1px solid var(--line); color: var(--text); font-size: 19px; font-weight: 850; }
.gateways { display: grid; gap: 8px; margin-top: 14px; }
.gateway { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 60px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 15px; background: transparent; color: var(--text); text-align: left; }
.gateway.selecionado { border-color: var(--primary); background: rgba(71, 230, 154, .08); }
.gateway strong { display: block; font-size: 15px; }
.gateway small { color: var(--muted); font-size: 13px; }
.gateway .valor { font-weight: 850; font-variant-numeric: tabular-nums; white-space: nowrap; }
.badge { display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 999px; background: var(--primary); color: #042016; font-size: 11px; font-weight: 850; vertical-align: middle; }

/* pix */
.amount-label { margin: 6px 0 16px; color: var(--primary); font-size: 40px; font-weight: 900; letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.qr-wrap { width: min(100%, 250px); aspect-ratio: 1; display: grid; place-items: center; margin: 0 auto 16px; padding: 12px; border-radius: 18px; background: #fff; }
.qr-wrap img { width: 100%; height: 100%; }
.pix-code { min-height: 88px; resize: none; padding: 12px; color: var(--muted); font: 12px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; word-break: break-all; }
.expiry { display: inline-flex; align-items: center; gap: 9px; margin: 0 0 18px; padding: 8px 13px; border: 1px solid rgba(71, 230, 154, .24); border-radius: 999px; background: rgba(71, 230, 154, .08); color: var(--muted); font-size: 13px; }
.expiry strong { min-width: 46px; color: var(--primary); font: 800 15px/1 ui-monospace, SFMono-Regular, Consolas, monospace; }
.legal { margin: 14px 0 0; color: #6f8b7e; font-size: 11px; line-height: 1.45; }
.spinner { width: 18px; height: 18px; border: 3px solid rgba(71, 230, 154, .25); border-top-color: var(--primary); border-radius: 50%; animation: gira 0.9s linear infinite; display: inline-block; vertical-align: -4px; margin-right: 8px; }
@keyframes gira { to { transform: rotate(360deg); } }

/* cadastro */
.server-item { padding: 12px 14px; border: 1px solid var(--line); border-radius: 15px; }
.server-item .linha { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.server-item input[type="text"] { margin-top: 10px; }

/* admin */
.admin { width: min(100%, 1180px); margin: 0 auto; padding: 22px 16px 60px; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.topbar h1 { font-size: 24px; }
.stats { display: flex; flex-wrap: wrap; gap: 10px; color: var(--muted); font-size: 14px; }
.stats b { color: var(--text); font-variant-numeric: tabular-nums; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tab { min-height: 40px; padding: 0 16px; border: 1px solid var(--line); border-radius: 12px; background: transparent; color: var(--muted); font-weight: 700; }
.tab.ativa { border-color: var(--primary); color: var(--primary); background: rgba(71, 230, 154, .08); }
.panel { padding: 20px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar input, .toolbar select { min-height: 44px; width: auto; flex: 1 1 180px; font-size: 15px; }
.toolbar button { flex: 0 0 auto; margin-top: 0; }
.toolbar .primary-button { min-height: 44px; }
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th { padding: 9px 10px; text-align: left; color: var(--muted); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.grid td { padding: 10px; border-bottom: 1px solid rgba(144, 238, 189, 0.09); vertical-align: middle; }
table.grid td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
table.grid tr:hover td { background: rgba(71, 230, 154, .04); }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.pill.ativo, .pill.creditado { background: rgba(71, 230, 154, .16); color: var(--primary); }
.pill.bloqueado, .pill.falhou, .pill.revisar { background: rgba(255, 139, 139, .14); color: var(--danger); }
.pill.pendente, .pill.creditando { background: rgba(255, 210, 122, .14); color: var(--warn); }
.pill.expirado { background: rgba(155, 184, 170, .14); color: var(--muted); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.row-actions button { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.empty { padding: 26px 0; text-align: center; color: var(--muted); }
.modal-back { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 16px; background: rgba(2, 8, 6, .72); overflow-y: auto; }
.modal { width: min(100%, 560px); max-height: calc(100vh - 32px); overflow-y: auto; padding: 24px; border: 1px solid var(--line); border-radius: 22px; background: #0c1d17; box-shadow: var(--shadow); }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.modal-actions .primary-button { min-height: 44px; margin-top: 0; }
.faixa-row { display: grid; grid-template-columns: 1fr 1fr 1.2fr 40px; gap: 6px; margin-bottom: 6px; }
.faixa-row input { min-height: 44px; font-size: 15px; padding: 0 10px; }
.faixa-row button { border: 1px solid var(--line); border-radius: 12px; background: transparent; color: var(--danger); font-size: 18px; }
.faixa-head { display: grid; grid-template-columns: 1fr 1fr 1.2fr 40px; gap: 6px; margin-bottom: 4px; color: var(--muted); font-size: 12px; }
.toast { position: fixed; left: 50%; bottom: 22px; z-index: 20; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 12px 18px; border: 1px solid var(--line); border-radius: 14px; background: #10261e; box-shadow: var(--shadow); font-size: 14px; }
.toast.erro { border-color: rgba(255, 139, 139, .4); color: var(--danger); }

@media (max-width: 520px) {
  .card { padding: 26px 20px; border-radius: 22px; }
  .panel { padding: 14px; }
  .phone-row { grid-template-columns: minmax(0, 148px) minmax(0, 1fr); }
  .phone-row select { font-size: 15px; padding-left: 12px; padding-right: 30px; }
}
