:root {
  --bg: #0b141a;
  --panel: #111b21;
  --card: #1f2c34;
  --line: #2a3942;
  --text: #e9edef;
  --muted: #8696a0;
  --accent: #25d366;
  --accent-dark: #1da851;
  --header: #123c2a;
  --danger: #ef4444;
  --warn: #f59e0b;
  --info: #38bdf8;
  --font: "Nunito", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  background: linear-gradient(160deg, #0a1f16, #05080b 55%, #111);
  color: var(--text);
  min-height: 100vh;
}

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

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 20px 50px rgba(0,0,0,.35);
}

.auth-card h1 { margin: 0 0 6px; font-size: 1.4rem; }
.auth-card p { margin: 0 0 18px; color: var(--muted); }

.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--header);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.brand {
  font-weight: 800;
  font-size: 1.1rem;
  padding: 8px 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,.12);
  margin-bottom: 8px;
}

.brand small { display: block; font-weight: 500; opacity: .75; margin-top: 4px; }

.brand-with-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-with-logo img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: #0b141a;
  border: 1px solid rgba(255,255,255,.18);
  flex-shrink: 0;
}
.brand-with-logo > div { min-width: 0; line-height: 1.2; }

.nav a {
  display: block;
  color: #fff;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
}
.nav a:hover, .nav a.active { background: rgba(255,255,255,.12); }

.sidebar .spacer { flex: 1; }

.content { padding: 22px; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.topbar h2 { margin: 0; font-size: 1.35rem; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}
.card .label { color: var(--muted); font-size: .85rem; }
.card .value { font-size: 1.5rem; font-weight: 800; margin-top: 6px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
}

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: .92rem;
}
th { color: var(--muted); font-weight: 700; }

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
}
.badge.active, .badge.approved { background: rgba(37,211,102,.15); color: var(--accent); }
.badge.pending { background: rgba(245,158,11,.15); color: var(--warn); }
.badge.rejected, .badge.suspended, .badge.expired { background: rgba(239,68,68,.15); color: #fca5a5; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 10px;
  padding: 9px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  color: #fff;
  background: var(--accent);
}
.btn:hover { background: var(--accent-dark); text-decoration: none; color: #fff; }
.btn.secondary { background: #334155; }
.btn.danger { background: var(--danger); }
.btn.sm { padding: 6px 10px; font-size: .82rem; }

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

label { display: block; margin-bottom: 6px; color: var(--muted); font-size: .85rem; }
input, select, textarea {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
}
textarea { min-height: 110px; resize: vertical; }

.alert {
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 14px;
}
.alert.error { background: rgba(239,68,68,.15); color: #fecaca; }
.alert.success { background: rgba(37,211,102,.15); color: #bbf7d0; }

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.plan-card h3 { margin: 0 0 6px; }
.plan-card .price { font-size: 1.6rem; font-weight: 800; margin: 10px 0; }
.plan-card ul { margin: 0 0 14px; padding-left: 18px; color: var(--muted); }

.qr-box {
  text-align: center;
  background: #fff;
  color: #111;
  border-radius: 14px;
  padding: 16px;
}
.qr-box img { max-width: 240px; width: 100%; height: auto; }
.checkout-grid {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 16px;
}

.msg-list { display: flex; flex-direction: column; gap: 8px; }
.msg {
  max-width: 80%;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--card);
  white-space: pre-wrap;
}
.msg.visitor { align-self: flex-end; background: #005c4b; }
.msg .meta { color: var(--muted); font-size: .75rem; margin-top: 4px; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 5; }
  .form-grid, .checkout-grid { grid-template-columns: 1fr; }
}
