:root {
  --bg: #0b0e11;
  --surface: #12161c;
  --surface-2: #171c23;
  --border: #232a33;
  --text: #e8ecef;
  --muted: #8b95a1;
  --pix: #2fd98a;
  --pix-dim: #1d9c63;
  --danger: #ff6b6b;
  --amber: #e8b35a;
  --radius: 14px;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, Menlo, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
}

body {
  background-image:
    radial-gradient(circle at 15% 0%, rgba(47, 217, 138, 0.08), transparent 40%),
    radial-gradient(circle at 85% 100%, rgba(47, 217, 138, 0.05), transparent 45%);
}

a { color: inherit; }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--pix), var(--pix-dim));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #06140d;
  font-size: 15px;
}

.brand-name { font-weight: 600; letter-spacing: 0.2px; }
.brand-sub { color: var(--muted); font-size: 12.5px; margin-top: -2px; }

label {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  margin: 16px 0 6px;
}

input, select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 11px 12px;
  color: var(--text);
  font-size: 14.5px;
  font-family: var(--sans);
  outline: none;
  transition: border-color 0.15s ease;
}

input:focus, select:focus { border-color: var(--pix-dim); }

button {
  cursor: pointer;
  border: none;
  border-radius: 9px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 14.5px;
  transition: transform 0.06s ease, opacity 0.15s ease;
}

button:active { transform: scale(0.98); }
button:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  width: 100%;
  padding: 12px;
  margin-top: 22px;
  background: var(--pix);
  color: #06140d;
}

.btn-primary:hover:not(:disabled) { background: #3ee79a; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 14px;
}

.btn-ghost:hover { border-color: var(--pix-dim); }

.error-msg {
  color: var(--danger);
  font-size: 13px;
  margin-top: 14px;
  min-height: 16px;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  margin-top: 18px;
  line-height: 1.5;
}

/* ---------- App shell ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
}

.topbar .who { font-size: 13.5px; color: var(--muted); }
.topbar .who b { color: var(--text); }

main {
  max-width: 920px;
  margin: 0 auto;
  padding: 28px 20px 80px;
  display: grid;
  gap: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}

.card h2 {
  margin: 0 0 4px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
}

.card .desc {
  color: var(--muted);
  font-size: 12.5px;
  margin: 0 0 18px;
}

.balance-hero {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.balance-hero .label {
  color: var(--muted);
  font-size: 12.5px;
  display: block;
  margin-bottom: 6px;
}

.balance-hero .amount {
  font-size: 38px;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.balance-hero .currency {
  color: var(--muted);
  font-size: 16px;
}

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 140px; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 700px) {
  .grid-2 { grid-template-columns: 1fr; }
}

/* Ticket / QR receipt */
.ticket {
  margin-top: 18px;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 18px;
  text-align: center;
  display: none;
}

.ticket.show { display: block; }

.ticket img {
  width: 190px;
  height: 190px;
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.qr-fallback {
  display: none;
  width: 190px;
  height: 190px;
  border-radius: 8px;
  background: #fff;
  padding: 8px;
  margin: 0 auto;
  align-items: center;
  justify-content: center;
}

.qr-fallback.show { display: flex; }
.qr-fallback img, .qr-fallback canvas, .qr-fallback table { width: 100% !important; height: 100% !important; }

.copy-row {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.copy-row input {
  font-family: var(--mono);
  font-size: 11.5px;
}

/* Table */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 500; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.4px; }
td.amount { font-family: var(--mono); }

.tag {
  display: inline-block;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 100px;
  font-weight: 600;
}

.tag-confirmed, .tag-completed { background: rgba(47,217,138,0.15); color: var(--pix); }
.tag-pending { background: rgba(232,179,90,0.15); color: var(--amber); }
.tag-failed, .tag-disputed { background: rgba(255,107,107,0.15); color: var(--danger); }

.empty-state {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 20px 0;
}

/* ---------- Admin: seção de clientes ---------- */
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.section-head .desc { margin-bottom: 0; }

.btn-compact { padding: 9px 16px; font-size: 13px; white-space: nowrap; }

/* ---------- Provedores de pagamento ---------- */
.provider-select-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.provider-select-row label {
  color: var(--muted);
  font-size: 12.5px;
}

.provider-select-inline {
  display: flex;
  gap: 8px;
  align-items: center;
}

.provider-select-inline select {
  width: auto;
  padding: 9px 12px;
  font-size: 13px;
}

.provider-balances {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 600px) {
  .provider-balances { grid-template-columns: 1fr; }
}

.provider-balance-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}

.provider-balance-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.provider-name { font-weight: 600; font-size: 13.5px; }

.provider-balance-result {
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--muted);
  min-height: 16px;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.stat-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}

.stat-box .stat-label {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  display: block;
  margin-bottom: 4px;
}

.stat-box .stat-value {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 600;
}

.new-client-form {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 18px;
}

.table-wrap { overflow-x: auto; }

.clients-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.clients-table th {
  text-align: left;
  padding: 10px 10px;
  color: var(--muted);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.clients-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.clients-table tbody tr:hover { background: rgba(255,255,255,0.02); }
.clients-table tbody tr:last-child td { border-bottom: none; }

.clients-table .client-name { font-weight: 600; font-size: 13.5px; }
.clients-table .client-date { color: var(--muted); font-size: 11px; margin-top: 2px; }
.clients-table .mono-cell { font-family: var(--mono); white-space: nowrap; }

.fee-edit { display: flex; gap: 6px; align-items: center; }
.fee-edit input {
  width: 68px;
  padding: 7px 8px;
  font-size: 12.5px;
  font-family: var(--mono);
}
.fee-edit button {
  padding: 7px 10px;
  font-size: 11.5px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
}
.fee-edit button:hover { border-color: var(--pix-dim); }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 100px;
  white-space: nowrap;
}
.status-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status-badge.active { background: rgba(47,217,138,0.15); color: var(--pix); }
.status-badge.blocked { background: rgba(255,107,107,0.15); color: var(--danger); }

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.row-actions button {
  padding: 7px 11px;
  font-size: 11.5px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
}

.row-actions button:hover { border-color: var(--pix-dim); }
.row-actions button.danger { color: var(--danger); }
.row-actions button.danger:hover { border-color: var(--danger); }
.row-actions button.warn { color: var(--amber); }
.row-actions button.warn:hover { border-color: var(--amber); }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  opacity: 0;
  transition: all 0.2s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
