:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #d97706;
  --danger: #dc2626;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-400: #9ca3af;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.13);
}

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  min-height: 100vh;
  line-height: 1.6;
}

/* ── Layout portal ── */
.portal-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 50%, #0ea5e9 100%);
  padding: 24px 16px 48px;
}

.portal-logo {
  text-align: center;
  margin-bottom: 32px;
  color: #fff;
}

.portal-logo .wifi-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 8px;
}

.portal-logo h1 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.portal-logo p {
  font-size: 0.95rem;
  opacity: 0.85;
}

.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 32px;
  width: 100%;
  max-width: 480px;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 20px;
}

/* ── Planos ── */
.plans-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.plan-card {
  border: 2px solid var(--gray-200);
  border-radius: 10px;
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  display: flex;
  align-items: center;
  gap: 16px;
  background: #fff;
  width: 100%;
  text-align: left;
}

.plan-card:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.plan-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.plan-info { flex: 1; }

.plan-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--gray-900);
}

.plan-desc {
  font-size: 0.82rem;
  color: var(--gray-600);
}

.plan-speed {
  font-size: 0.78rem;
  color: var(--gray-400);
  margin-top: 2px;
}

.plan-price {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--primary);
  flex-shrink: 0;
}

/* ── PIX payment page ── */
.qr-box {
  text-align: center;
  padding: 8px 0 16px;
}

.qr-box img {
  width: 220px;
  height: 220px;
  border-radius: 8px;
  border: 1px solid var(--gray-200);
}

.pix-copy {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.pix-copy input {
  flex: 1;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.8rem;
  color: var(--gray-700);
  background: var(--gray-50);
  outline: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 22px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.15s, transform 0.1s;
  text-decoration: none;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover { background: var(--primary-dark); }

.btn-sm {
  padding: 8px 14px;
  font-size: 0.82rem;
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--primary);
  color: var(--primary);
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
}

.badge-pending {
  background: #fef3c7;
  color: #92400e;
}

.badge-paid {
  background: var(--success-light);
  color: #14532d;
}

.divider {
  border: none;
  border-top: 1px solid var(--gray-200);
  margin: 20px 0;
}

.info-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  margin-bottom: 8px;
}

.info-row .label { color: var(--gray-600); }
.info-row .value { font-weight: 600; color: var(--gray-900); }

.timer {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  text-align: center;
  margin: 8px 0;
}

/* ── Sucesso ── */
.success-icon {
  font-size: 64px;
  text-align: center;
  display: block;
  margin-bottom: 12px;
}

.success-title {
  text-align: center;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--success);
  margin-bottom: 6px;
}

.success-sub {
  text-align: center;
  color: var(--gray-600);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

/* ── Admin layout ── */
.admin-wrap {
  min-height: 100vh;
  display: flex;
}

.sidebar {
  width: 240px;
  background: var(--gray-900);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  flex-shrink: 0;
}

.sidebar-logo {
  padding: 0 24px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo h2 {
  font-size: 1rem;
  font-weight: 700;
}

.sidebar-logo span {
  font-size: 0.78rem;
  opacity: 0.5;
}

.sidebar-nav {
  padding: 16px 0;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover, .nav-item.active {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.nav-icon { font-size: 16px; }

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.admin-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: auto;
}

.admin-header {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-header h1 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray-900);
}

.admin-main {
  padding: 32px;
  flex: 1;
}

/* ── Stats cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
}

.stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-400);
  margin-bottom: 4px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--gray-900);
}

.stat-value.green { color: var(--success); }
.stat-value.blue { color: var(--primary); }

/* ── Table ── */
.table-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.table-header h2 {
  font-size: 1rem;
  font-weight: 700;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

thead th {
  background: var(--gray-50);
  padding: 10px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-600);
  border-bottom: 1px solid var(--gray-200);
}

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--gray-50); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-green { background: var(--success-light); color: #14532d; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }
.badge-red { background: #fee2e2; color: #991b1b; }

/* ── Login admin ── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-100);
  padding: 16px;
}

.login-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
}

.login-card h1 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.login-card p {
  color: var(--gray-600);
  font-size: 0.88rem;
  margin-bottom: 28px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-group input, .form-group select {
  width: 100%;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.9rem;
  color: var(--gray-800);
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}

.form-group input:focus, .form-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.btn-block { width: 100%; }

.alert-error {
  background: #fee2e2;
  color: #991b1b;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.85rem;
  margin-bottom: 16px;
}

/* ── Plans admin ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 50;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 32px;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 20px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── Utilities ── */
.text-center { text-align: center; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.w-full { width: 100%; }
.flex { display: flex; }
.gap-8 { gap: 8px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

@media (max-width: 640px) {
  .card { padding: 24px 16px; }
  .admin-wrap { flex-direction: column; }
  .sidebar { width: 100%; }
  .admin-main { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
