:root {
  --bg:       #0d0d0d;
  --surface:  #161616;
  --card:     #1e1e1e;
  --border:   #2a2a2a;
  --accent:   #00c853;
  --accent2:  #00e676;
  --text:     #f0f0f0;
  --muted:    #888;
  --danger:   #ff4444;
  --warning:  #ffaa00;
  --radius:   12px;
}

body.light {
  --bg:       #f4f5f7;
  --surface:  #ffffff;
  --card:     #ffffff;
  --border:   #e2e4e9;
  --accent:   #00a844;
  --accent2:  #00c853;
  --text:     #1a1a1a;
  --muted:    #6b7280;
  --danger:   #dc2626;
  --warning:  #d97706;
}

/* Inputs no tema claro */
body.light input,
body.light select,
body.light textarea {
  background: #f9fafb;
  color: #1a1a1a;
  border-color: #d1d5db;
}

body.light input:focus,
body.light select:focus,
body.light textarea:focus {
  border-color: var(--accent);
  background: #fff;
}

body.light .sidebar {
  background: #fff;
  border-right-color: #e2e4e9;
}

body.light .sidebar nav a { color: #6b7280; }
body.light .sidebar nav a:hover,
body.light .sidebar nav a.active { color: #1a1a1a; background: #f4f5f7; }

/* Toggle button */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
  margin: 12px 20px 0;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--text); }

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent2); }

/* ── Layout ── */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
}

.sidebar-logo {
  padding: 0 20px 24px;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.5px;
}

.sidebar-logo img { height: 36px; object-fit: contain; }

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--muted);
  border-left: 3px solid transparent;
  transition: all 0.15s;
  font-size: 13px;
}

.sidebar nav a:hover,
.sidebar nav a.active {
  color: var(--text);
  background: var(--card);
  border-left-color: var(--accent);
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px 20px;
  font-size: 12px;
  color: var(--muted);
}

.main-content {
  margin-left: 220px;
  flex: 1;
  padding: 32px;
  max-width: calc(100vw - 220px);
}

/* ── Cards ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

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

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
}

.stat-label { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }

input, select, textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--muted); }
textarea { resize: vertical; min-height: 80px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}

.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover { background: var(--accent2); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #333; }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 10px 12px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border); }
td { padding: 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}

.badge-green  { background: rgba(0,200,83,0.15);  color: var(--accent); }
.badge-yellow { background: rgba(255,170,0,0.15); color: var(--warning); }
.badge-red    { background: rgba(255,68,68,0.15); color: var(--danger); }
.badge-gray   { background: rgba(255,255,255,0.07); color: var(--muted); }

/* ── Page header ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title { font-size: 22px; font-weight: 700; }

/* ── Alerts ── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 13px;
}

.alert-success { background: rgba(0,200,83,0.1); border: 1px solid rgba(0,200,83,0.3); color: var(--accent); }
.alert-danger  { background: rgba(255,68,68,0.1); border: 1px solid rgba(255,68,68,0.3); color: var(--danger); }

/* ── Auth pages ── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
}

.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo h1 {
  font-size: 24px;
  font-weight: 800;
  color: var(--accent);
}

.auth-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
}

.auth-sub {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 28px;
}

/* ── Payment page ── */
.pay-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
}

.pay-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px;
  width: 100%;
  max-width: 420px;
}

.pay-brand {
  text-align: center;
  margin-bottom: 28px;
}

.pay-brand img { height: 44px; object-fit: contain; margin-bottom: 8px; }
.pay-brand h2 { font-size: 18px; font-weight: 700; }
.pay-brand p  { font-size: 12px; color: var(--muted); }

.pay-amount {
  text-align: center;
  background: rgba(0,200,83,0.07);
  border: 1px solid rgba(0,200,83,0.2);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}

.pay-amount label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; display: block; margin-bottom: 8px; }
.pay-amount .value { font-size: 36px; font-weight: 800; color: var(--text); }

.amount-input-wrap {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
}
.amount-currency {
  font-size: 22px;
  font-weight: 700;
  color: var(--muted);
}
.pay-amount input.value-input {
  background: transparent;
  border: none;
  text-align: center;
  font-size: 36px;
  font-weight: 800;
  color: var(--text);
  padding: 0;
  width: 180px;
  outline: none;
  -moz-appearance: textfield;
  appearance: textfield;
}
.pay-amount input.value-input::-webkit-outer-spin-button,
.pay-amount input.value-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}
.pay-amount input.value-input::placeholder { color: var(--muted); opacity: 0.5; }

.amount-min-hint {
  margin-top: 10px;
  font-size: 11px;
  color: var(--muted);
}

.trust-badges {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 20px 0;
}

.trust-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
}

.trust-badge .icon {
  width: 44px; height: 44px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.qr-section {
  text-align: center;
  padding: 24px 0;
}

.qr-code-text {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-size: 11px;
  word-break: break-all;
  color: var(--muted);
  margin: 16px 0;
  text-align: left;
  max-height: 80px;
  overflow: hidden;
}

.qr-img { margin: 16px auto; display: block; }

.copy-btn {
  background: var(--surface);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 8px;
  padding: 10px 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  width: 100%;
  transition: all 0.15s;
}

.copy-btn:hover { background: var(--accent); color: #000; }
.copy-btn.copied { background: var(--accent); color: #000; }

/* Container dos botões pós-QR (já paguei / novo pagamento) */
.post-qr-actions {
  display: block;
  margin-top: 10px;
}

/* Estilo base — segue o padrão do .copy-btn (full-width, padding 10/20) */
.ja-paguei-btn,
.novo-pag-btn {
  display: block;
  width: 100%;
  box-sizing: border-box;
  border-radius: 8px;
  padding: 10px 20px;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}

.ja-paguei-btn {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #000;
  font-weight: 700;
}
.ja-paguei-btn:hover { background: var(--accent2); border-color: var(--accent2); }

.novo-pag-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
}
.novo-pag-btn:hover { color: var(--text); border-color: var(--muted); }

.ja-paguei-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #000;
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  margin-right: 6px;
  vertical-align: -3px;
}

/* ── Slug preview ── */
.slug-preview {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.slug-preview span { color: var(--accent); }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}

.empty-state .icon { font-size: 40px; margin-bottom: 12px; }
.empty-state p { margin-bottom: 16px; }

/* ── Divider ── */
hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ── Provider toggle ── */
.provider-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}

.provider-opt {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}

.provider-opt input[type=radio] { display: none; }
.provider-opt:has(input:checked) { border-color: var(--accent); background: rgba(0,200,83,0.05); }
.provider-opt .pname { font-size: 13px; font-weight: 600; margin-top: 6px; }
.provider-opt .pdesc { font-size: 11px; color: var(--muted); }

/* ── Mobile top bar ── */
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 200;
}

.mobile-topbar-logo {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
}

.mobile-menu-btn {
  background: none;
  border: none;
  color: var(--text);
  font-size: 22px;
  cursor: pointer;
  padding: 4px;
}

/* ── Mobile drawer ── */
.mobile-drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 300;
}

.mobile-drawer-overlay.open { display: block; }

.mobile-drawer {
  position: fixed;
  top: 0; left: -260px; bottom: 0;
  width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 400;
  transition: left 0.25s ease;
  display: flex;
  flex-direction: column;
  padding: 24px 0;
}

.mobile-drawer.open { left: 0; }

.mobile-drawer-logo {
  padding: 0 20px 20px;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}

.mobile-drawer nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  color: var(--muted);
  border-left: 3px solid transparent;
  font-size: 14px;
  text-decoration: none;
}

.mobile-drawer nav a.active,
.mobile-drawer nav a:hover {
  color: var(--text);
  background: var(--card);
  border-left-color: var(--accent);
}

.mobile-drawer-footer {
  margin-top: auto;
  padding: 16px 20px;
  font-size: 12px;
  color: var(--muted);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar      { display: none !important; }
  .mobile-topbar { display: flex; }
  .main-content {
    margin-left: 0;
    padding: 76px 16px 24px;
    max-width: 100%;
  }

  /* Stats: 2 col em mobile */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }

  /* Tabelas: scroll horizontal */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 560px; }
  th, td { padding: 10px 10px; font-size: 12px; }

  /* Cards */
  .card { padding: 16px; }

  /* Page header: stack vertical */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .page-title { font-size: 18px; }

  /* Formulários */
  .provider-group { grid-template-columns: 1fr; }

  /* Link criar: grid único */
  .link-criar-grid { grid-template-columns: 1fr !important; }

  /* Auth */
  .auth-card { padding: 28px 20px; }

  /* Pay page */
  .pay-card { padding: 24px 18px; }
  .trust-badges { gap: 12px; }
  .trust-badge .icon { width: 36px; height: 36px; font-size: 16px; }

  /* Botões */
  .btn { font-size: 13px; }

  /* Stat value menor */
  .stat-value { font-size: 22px; }

  /* Esconder tema float no mobile (está na topbar) */
  .theme-float { top: 8px; right: 56px; padding: 4px 10px; font-size: 11px; }
}

@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr; }
  .trust-badges { gap: 8px; }
}

/* ── Theme toggle flutuante (páginas sem sidebar) ── */
.theme-float {
  position: fixed;
  top: 16px;
  right: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 999;
  transition: all 0.15s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.theme-float:hover { border-color: var(--accent); color: var(--text); }

/* Light mode fixes para inputs de auth/pay */
body.light .auth-card,
body.light .pay-card {
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}

body.light .qr-code-text { background: #f4f5f7; color: #444; }
body.light .trust-badge .icon { background: #f4f5f7; border-color: #e2e4e9; }
body.light .copy-btn { background: #f4f5f7; }
body.light .stat-card { box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
body.light .badge-gray { background: rgba(0,0,0,0.06); color: #555; }
