:root {
  --brand: #044f8b;
  --ink: #0f172a;
  --muted: #64748b;
}

/* Primary button override */
.btn-primary {
  background-color: #044f8b;
  border-color: #044f8b;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
  background-color: #03437a;
  border-color: #03437a;
}

/* App layout */
.app-body {
  --sidebar-width: 260px;
  --brand: #0f6d7a;
  --brand-soft: #e6f3f4;
  --panel: #ffffff;
  --panel-muted: #f8fafc;
  --surface: #ffffff;
  --ink: #0f172a;
  --muted: #6b7280;
  --border: #e5e7eb;
  color: var(--ink);
  font-family: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: #f1f5f9;
}

.app-body .app-shell {
  min-height: 100vh;
  gap: 1.5rem;
  padding: 1.5rem;
}

.app-body .sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  max-width: var(--sidebar-width);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  flex: 0 0 var(--sidebar-width);
}

.app-body.sidebar-collapsed .sidebar {
  width: 90px;
  min-width: 90px;
  max-width: 90px;
  padding: 1.25rem 0.75rem;
}

.app-body.sidebar-collapsed .sidebar .nav-link span,
.app-body.sidebar-collapsed .sidebar .section-title,
.app-body.sidebar-collapsed .sidebar .sidebar-footer small,
.app-body.sidebar-collapsed .sidebar .sidebar-footer .btn,
.app-body.sidebar-collapsed .sidebar .sidebar-footer .user-name,
.app-body.sidebar-collapsed .sidebar .sidebar-footer .user-role {
  display: none !important;
}

.app-body.sidebar-collapsed .sidebar .nav-link {
  justify-content: center;
}

.app-body.sidebar-collapsed .brand-text {
  display: none;
}

.app-body .brand-logo {
  width: auto;
  height: 48px;
}

.app-body.sidebar-collapsed .brand-logo-open {
  display: none;
}

.app-body.sidebar-collapsed .brand-logo-collapsed {
  display: inline-block !important;
  height: 40px;
}

.app-body.sidebar-collapsed .sidebar-footer {
  background: transparent;
  border: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  position: relative;
}

.app-body.sidebar-collapsed .sidebar .sidebar-toggle {
  margin-left: 0 !important;
}

.app-body.sidebar-collapsed .sidebar .sidebar-toggle {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.app-body.sidebar-collapsed .sidebar .sidebar-toggle svg {
  margin: 0;
}

.app-body .sidebar-brand-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.app-body.sidebar-collapsed .sidebar .sidebar-brand-row {
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.app-body .profile-popover {
  position: absolute;
  left: calc(100% + 16px);
  bottom: 0;
  min-width: 220px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
  padding: 0.9rem;
  display: none;
  z-index: 10;
}

.app-body.sidebar-collapsed .sidebar-footer:hover .profile-popover {
  display: block;
}

.app-body .profile-popover .profile-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.app-body .profile-popover .profile-meta {
  color: var(--muted);
  font-size: 0.8rem;
}

.app-body .sidebar-toggle {
  border-radius: 12px;
}

@media (max-width: 991px) {
  .app-body .app-shell {
    flex-direction: column;
    padding: 1rem;
    gap: 1rem;
  }

  .app-body .sidebar {
    width: 280px;
    min-width: 280px;
    max-width: 280px;
    border-radius: 18px;
    position: fixed;
    top: 1rem;
    left: 1rem;
    bottom: 1rem;
    z-index: 1050;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
    display: none;
  }

  .app-body.mobile-sidebar-open .sidebar {
    display: flex;
  }

  .app-body .dashboard-footer {
    margin: 0 1rem 1rem;
    padding: 0.85rem 1rem;
  }

  .app-body main.flex-grow-1 {
    padding: 1rem !important;
  }

  .app-body .mobile-sidebar-toggle {
    display: inline-flex !important;
  }
}

.app-body .mobile-sidebar-toggle {
  display: none;
  align-items: center;
  gap: 0.5rem;
  border-radius: 12px;
}

.app-body .sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 1040;
}

.app-body.mobile-sidebar-open .sidebar-overlay {
  display: block;
}

.app-body .sidebar .nav-link {
  color: var(--ink);
  font-weight: 500;
  border-radius: 14px;
  padding: 0.6rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.app-body .sidebar .nav-link.active {
  color: var(--ink);
  background: var(--panel-muted);
  box-shadow: inset 0 0 0 1px var(--border);
}

.app-body .sidebar .section-title {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

.app-body .brand-chip {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--brand-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--brand);
  font-weight: 700;
}

.app-body .sidebar-footer {
  margin-top: auto;
  background: var(--panel-muted);
  border-radius: 16px;
  padding: 0.85rem;
  border: 1px solid var(--border);
  text-align: center;
}

.app-body .sidebar-footer small {
  color: var(--muted);
}

.app-body .stat-card {
  border: 0;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
}

.app-body .stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #f1f5f9;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #0f172a;
}

.app-body .chip {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.85rem;
}

.app-body .dashboard-footer {
  margin: 0 1.5rem 1.5rem;
  padding: 1rem 1.5rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  color: var(--ink);
  font-size: 0.9rem;
}

/* Affiliate link */
.app-body .affiliate-card {
  max-width: 600px;
  width: 100%;
  border-radius: 22px;
  overflow: hidden;
}

.app-body .affiliate-card-wrap {
  display: flex;
  justify-content: center;
}

.app-body .affiliate-card .badge {
  letter-spacing: 0.02em;
}

.app-body .qr-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: #fff;
  padding: 8px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.app-body .qr-download:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.15);
}

/* Affiliate bank */
.app-body .bank-card {
  background: linear-gradient(135deg, #0f172a, #1d4ed8);
  color: #fff;
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 18px 30px rgba(15, 23, 42, 0.25);
  position: relative;
  overflow: hidden;
}

.app-body .bank-card::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 140px;
  height: 140px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 50%;
}

.app-body .bank-card::before {
  content: "";
  position: absolute;
  right: 40px;
  bottom: -60px;
  width: 180px;
  height: 180px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
}

.app-body .bank-card .chip {
  width: 42px;
  height: 32px;
  border-radius: 6px;
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
}

.app-body .bank-card .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.75;
}

/* Auth layout */
.auth-body {
  --ink: #0f172a;
  --muted: #64748b;
  --panel: #ffffff;
  --border: #e5e7eb;
  --shadow: 0 30px 80px rgba(15, 23, 42, 0.18);
  color: var(--ink);
  background: #0f2a2f;
  min-height: 100vh;
  font-family: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
}

.auth-body .auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2.5rem 1.5rem;
}

.auth-body .auth-frame {
  background: var(--panel);
  border-radius: 28px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  max-width: 1240px;
  width: 100%;
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  overflow: hidden;
}

.auth-body .auth-side {
  padding: 3.5rem 4rem;
}

.auth-body .auth-side form {
  max-width: 520px;
}

.auth-body .auth-visual {
  background: linear-gradient(145deg, #2e4d4f, #496668);
  position: relative;
}

.auth-body .auth-visual::after {
  content: "";
  position: absolute;
  inset: 16px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.auth-body .auth-visual .visual-placeholder {
  position: absolute;
  inset: 18px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.08);
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.95rem;
  text-align: center;
  padding: 1.5rem;
}

.auth-body .auth-visual .visual-image {
  position: absolute;
  inset: 18px;
  border-radius: 20px;
  overflow: hidden;
}

.auth-body .auth-visual .visual-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.auth-body .auth-logo {
  height: 56px;
  width: auto;
}

.auth-body .auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.auth-body .auth-help {
  color: var(--muted);
  margin-bottom: 2rem;
}

.auth-body .auth-back-link {
  display: inline-block;
  color: #2563eb;
  text-decoration: none;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.auth-body .auth-back-link:hover {
  text-decoration: underline;
}

.auth-body .auth-heading {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.auth-body .auth-heading .auth-help {
  margin-bottom: 0;
}

.auth-body .auth-card {
  border: 0;
  box-shadow: none;
  border-radius: 16px;
}

@media (max-width: 992px) {
  .auth-body .auth-frame {
    grid-template-columns: 1fr;
  }

  .auth-body .auth-visual {
    min-height: 260px;
  }

  .auth-body .auth-side {
    padding: 2.5rem;
  }
}

/* Public form layout */
.public-body {
  --brand: #044f8b;
  --brand-soft: #dbeafe;
  --ink: #0f172a;
  --muted: #64748b;
  color: var(--ink);
  font-family: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #eef4ff 0%, #f8fafc 45%, #ffffff 100%);
  min-height: 100vh;
}

.public-body .public-shell {
  min-height: 100vh;
  padding: 3rem 0;
}

.public-body .public-header {
  text-align: center;
  margin-bottom: 2rem;
}

.public-body .public-header img {
  height: 110px;
  width: auto;
}

.public-body .public-subtitle {
  color: var(--muted);
  margin-top: 0.5rem;
}

.public-body .public-welcome {
  margin-top: 0.75rem;
  color: #0f172a;
  font-weight: 600;
}

.public-body .card {
  border-radius: 22px;
  border: 1px solid #e5e7eb;
}

/* Public affiliate form */
.public-body .public-hero {
  background: linear-gradient(135deg, #e7f5ff 0%, #f7f7ff 55%, #ffffff 100%);
  border-radius: 20px;
  padding: 1.75rem;
  border: 1px solid #e5e7eb;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
  margin-bottom: 1.5rem;
}

.public-body .public-hero h1 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.public-body .public-hero p {
  color: #64748b;
  margin-bottom: 0;
}

.public-body .public-card {
  border-radius: 20px;
}

.public-body .form-pill {
  background: #f1f5f9;
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  font-size: 0.85rem;
  color: #0f172a;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.public-body .captcha-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.public-body .captcha-question {
  font-weight: 600;
  color: #0f172a;
}

.public-body .captcha-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.public-body .captcha-input {
  max-width: 180px;
}

/* Public affiliate success */
.public-body .success-wrap {
  display: grid;
  gap: 1.5rem;
  place-items: center;
}

.public-body .success-card {
  max-width: 520px;
  width: 100%;
  border-radius: 22px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 24px 50px rgba(15, 23, 42, 0.12);
  text-align: center;
  overflow: hidden;
  position: relative;
}

.public-body .success-header {
  background: radial-gradient(circle at top, #dbeafe 0%, #eff6ff 55%, #ffffff 100%);
  padding: 2rem 2rem 1.5rem;
}

.public-body .success-body {
  padding: 1.5rem 2rem 2rem;
}

.public-body .success-badge {
  width: 72px;
  height: 72px;
  border-radius: 24px;
  background: #0ea5e9;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  box-shadow: 0 16px 30px rgba(14, 165, 233, 0.35);
  animation: pop 0.6s ease;
}

.public-body .success-lines {
  margin-top: 1.25rem;
  color: #64748b;
}

.public-body .success-confetti {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(14, 165, 233, 0.25) 2px, transparent 2px),
    radial-gradient(circle, rgba(16, 185, 129, 0.25) 2px, transparent 2px);
  background-size: 18px 18px, 22px 22px;
  background-position: 0 0, 12px 8px;
  opacity: 0.4;
  animation: drift 6s linear infinite;
  pointer-events: none;
}

@keyframes pop {
  0% {
    transform: scale(0.6);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes drift {
  0% {
    background-position: 0 0, 12px 8px;
  }
  100% {
    background-position: 60px 120px, 72px 90px;
  }
}

/* Home page */
.home-body {
  color: var(--ink);
}

.home-body .hero {
  background: radial-gradient(circle at 20% 20%, #e8f1ff, #ffffff 50%, #f8fafc 90%);
}

.home-body .hero-card {
  border: 0;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.12);
}

.home-body .stat {
  border-radius: 1rem;
  background: #ffffff;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
}
