@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #f8fafc;
  --white: #ffffff;
  --text: #111827;
  --muted: #64748b;
  --border: #e5e7eb;
  --accent: #4f46e5;
  --accent-soft: #eef2ff;
  --radius: 12px;
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
}

* { box-sizing: border-box; -webkit-font-smoothing: antialiased; }

body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* Disembunyikan sampai token divalidasi ke backend — dibuka lewat body.access-granted
   supaya tidak ada sedikit pun struktur halaman yang sempat ke-render kalau token salah. */
.app-shell { display: none; min-height: 100vh; align-items: flex-start; }
body.access-granted .app-shell { display: flex; }

.invalid-token-overlay {
  position: fixed;
  inset: 0;
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 9999;
}

.invalid-token-box { max-width: 420px; text-align: center; }

.invalid-token-box p {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

.sidebar {
  /* Logo dirender ~106px (lihat sidebar-logo); sidebar cuma dibuat sedikit lebih
     lebar dari itu, bukan lebar dashboard standar. */
  width: 160px;
  flex-shrink: 0;
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  padding: 0 4px;
  margin-bottom: 24px;
}

.sidebar-logo {
  display: block;
  height: 28px;
  width: auto;
  margin-bottom: 6px;
}

.sidebar-brand-sub {
  display: block;
  font-weight: 800;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  /* Lebar di-set lewat JS (fitBrandLabelToLogo di common.js) supaya sama persis
     dengan lebar render logo, lalu inter-character justify meregangkan hurufnya. */
  text-align: justify;
  text-align-last: justify;
  text-justify: inter-character;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.sidebar-link {
  display: block;
  padding: 10px 8px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  line-height: 1.3;
}

.sidebar-link:hover { background: #f1f5f9; color: var(--text); }

.sidebar-link.active { background: var(--accent-soft); color: var(--accent); }

.sidebar-badge {
  margin-top: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--muted);
}

.sidebar-badge strong {
  display: block;
  color: var(--text);
  font-size: 13px;
  margin-top: 2px;
}

.main-content { flex: 1; min-width: 0; padding: 32px 32px 64px; }

/* Halaman data (Try Out/Kerjasama/Komisi Referal) memakai panel putih polos
   yang menyatu langsung dengan sidebar, bukan card terpisah di atas bg abu-abu. */
.main-content--flush { background: var(--white); }
.table-panel { overflow: hidden; }

.mobile-menu-toggle { display: none; }
.sidebar-backdrop { display: none; }

@media (max-width: 720px) {
  /* Di mobile, sidebar tetap sidebar (bukan jadi topbar) — cuma disembunyikan
     sebagai drawer di luar layar, dibuka lewat tombol garis tiga (hamburger). */
  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 12px;
    left: 12px;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--white);
    box-shadow: var(--shadow);
    font-size: 18px;
    line-height: 1;
    color: var(--text);
    z-index: 10001;
    cursor: pointer;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 220px;
    max-width: 80vw;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 10000;
    box-shadow: var(--shadow);
  }

  body.sidebar-open .sidebar { transform: translateX(0); }

  /* Tombol hamburger nutupin logo/Partnership begitu drawer kebuka — sembunyikan
     aja, nutup drawer masih bisa lewat tap backdrop atau klik link menu. */
  body.sidebar-open .mobile-menu-toggle { display: none; }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  body.sidebar-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }

  .main-content { padding: 72px 16px 48px; }
  .state-box { min-height: 260px; }
  .terms-card { padding: 20px 16px; }
  .home-cards { grid-template-columns: 1fr; }
}

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

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

table { width: 100%; border-collapse: collapse; min-width: 920px; }

th, td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-size: 13px;
}

th {
  background: #f1f5f9;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.04em;
  position: sticky;
  top: 0;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbff; }

.status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status-verified { background: #dcfce7; color: #166534; }
.status-pending { background: #fef9c3; color: #854d0e; }
.status-rejected { background: #fee2e2; color: #991b1b; }
.status-progress { background: #dbeafe; color: #1e40af; }
.status-account { background: #fae8ff; color: #86198f; }
.status-other { background: #e0e7ff; color: #3730a3; }

.muted-cell { color: var(--muted); }

.note-cell {
  color: #991b1b;
  font-style: italic;
  white-space: normal;
  min-width: 260px;
}

.state-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 340px;
  padding: 24px;
  color: var(--muted);
}

.state-box.error { color: #b91c1c; }

.state-box h2 {
  font-size: 16px;
  margin: 0 0 8px;
  color: inherit;
}

/* Logo Lenterago dipakai sebagai CSS mask, lalu gradient di belakangnya
   digeser (kilatan cahaya/shimmer) — dipakai selagi data tabel masih di-fetch. */
.loading-logo {
  width: 160px;
  aspect-ratio: 2550 / 675;
  margin: 0 auto;
  -webkit-mask-image: url("/assets/lenterago-logo.svg");
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-image: url("/assets/lenterago-logo.svg");
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  background: linear-gradient(100deg, #cbd5e1 30%, #eef2ff 45%, #ffffff 50%, #eef2ff 55%, #cbd5e1 70%);
  background-size: 220% 100%;
  animation: loading-logo-shimmer 1.4s ease-in-out infinite;
}

@keyframes loading-logo-shimmer {
  0% { background-position: 160% 0; }
  100% { background-position: -60% 0; }
}

.footer-note {
  margin-top: 16px;
  font-size: 12px;
  color: var(--muted);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.toolbar label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.toolbar select {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}

.home-hero { margin-bottom: 28px; }
.home-hero h1 { font-size: 22px; margin: 0 0 8px; }
.home-hero p { margin: 0; color: var(--muted); max-width: 620px; }

.home-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.home-card {
  display: block;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  text-decoration: none;
  color: inherit;
}

.home-card:hover { border-color: var(--accent); }

.home-card h3 { margin: 0 0 8px; font-size: 15px; color: var(--accent); }
.home-card p { margin: 0; color: var(--muted); font-size: 13px; }

.terms-section { margin-top: 28px; }

.terms-card { padding: 24px 28px; }

.terms-wrap { position: relative; }

.terms-wrap .terms-content {
  max-height: 260px;
  overflow: hidden;
}

.terms-wrap.expanded .terms-content { max-height: none; }

.terms-wrap:not(.expanded)::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 72px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), var(--white));
  pointer-events: none;
}

.terms-content h2 { font-size: 16px; margin: 0 0 10px; text-align: center; }
.terms-content h3 { font-size: 13px; margin: 18px 0 6px; color: var(--text); }
.terms-content h3:first-of-type { margin-top: 0; }
.terms-content p { margin: 0 0 4px; color: var(--muted); font-size: 13px; line-height: 1.7; text-align: justify; }
.terms-content ul { margin: 4px 0 8px; padding-left: 20px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.terms-content li { text-align: justify; }

.terms-toggle {
  display: inline-block;
  margin-top: 14px;
  background: none;
  border: 1px solid var(--border);
  color: var(--accent);
  font-family: inherit;
  font-weight: 700;
  font-size: 12px;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
}

.terms-toggle:hover { background: var(--accent-soft); }
