:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface2: #f1f5f9;
  --border: #dbeafe;
  --accent: #3b82f6;
  --accent2: #06b6d4;
  --green: #10b981;
  --red: #ef4444;
  --yellow: #f59e0b;
  --purple: #8b5cf6;
  --text: #1e293b;
  --text-muted: #64748b;
  --text-dim: #475569;
  --sidebar-w: 220px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'DM Sans', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; display: flex; }

/* SIDEBAR */
.sidebar { width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; z-index: 50; overflow-y: auto; }
.sidebar-logo { padding: 20px 16px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); }
.logo-icon { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), var(--accent2)); display: flex; align-items: center; justify-content: center; font-family: 'Syne', sans-serif; font-weight: 800; font-size: 1rem; color: white; flex-shrink: 0; }
.logo-title { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 0.92rem; }
.logo-sub { font-size: 0.7rem; color: var(--text-muted); }
.sidebar-nav { flex: 1; padding: 12px 10px; }
.nav-label { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; padding: 10px 8px 6px; }
.nav-item { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 8px; color: var(--text-muted); text-decoration: none; font-size: 0.875rem; font-weight: 500; transition: all 0.2s; margin-bottom: 2px; }
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: rgba(59,130,246,0.15); color: var(--accent); }
.nav-icon { font-size: 1rem; width: 20px; text-align: center; }
.sidebar-footer { padding: 14px 10px; border-top: 1px solid var(--border); }
.user-info { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.user-avatar { width: 32px; height: 32px; border-radius: 8px; background: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.9rem; color: white; flex-shrink: 0; }
.user-name { font-size: 0.82rem; font-weight: 600; }
.user-role { font-size: 0.7rem; color: var(--text-muted); text-transform: capitalize; }
.btn-logout { display: block; text-align: center; padding: 7px; border-radius: 7px; background: rgba(239,68,68,0.1); color: var(--red); text-decoration: none; font-size: 0.8rem; font-weight: 500; }
.btn-login { display: block; text-align: center; padding: 9px; border-radius: 8px; background: var(--accent); color: white; text-decoration: none; font-size: 0.85rem; font-weight: 600; }

/* MAIN */
.main-wrap { margin-left: var(--sidebar-w); flex: 1; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { padding: 0 24px; height: 56px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; background: rgba(255,255,255,0.85); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 40; color: var(--text); }
.topbar-title { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 1rem; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100%{opacity:1;box-shadow:0 0 0 0 rgba(16,185,129,0.4)}50%{opacity:.8;box-shadow:0 0 0 6px rgba(16,185,129,0)} }
.live-clock { background: rgba(255,255,255,0.8); border: 1px solid var(--border); color: var(--text); padding: 5px 12px; border-radius: 99px; font-family: 'Syne', monospace; font-size: 0.85rem; font-weight: 700; letter-spacing: 0.05em; display: inline-flex; align-items: center; gap: 6px; box-shadow: 0 2px 6px rgba(0,0,0,0.02); }
.live-clock span { color: var(--accent); font-size: 1rem; }
.content { padding: 24px; flex: 1; }

/* FLASH */
.flash { padding: 12px 16px; border-radius: 10px; margin: 0 24px; font-size: 0.88rem; font-weight: 500; }
.flash-success { background: rgba(16,185,129,0.15); color: var(--green); border: 1px solid rgba(16,185,129,0.3); }
.flash-error { background: rgba(239,68,68,0.15); color: var(--red); border: 1px solid rgba(239,68,68,0.3); }

/* HERO */
.hero { background: linear-gradient(135deg, #e0e7ff, #f3e8ff); border: 1px solid #c7d2fe; border-radius: 12px; padding: 18px 24px; margin-bottom: 20px; display: flex; align-items: center; justify-content: space-between; box-shadow: 0 4px 15px rgba(99,102,241,0.08); }
.hero-title { font-family: 'Syne', sans-serif; font-size: 1.3rem; font-weight: 800; line-height: 1.2; background: linear-gradient(to right, #1e293b, var(--accent)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.hero-title em { font-style: normal; color: var(--accent2); -webkit-text-fill-color: var(--accent2); }
.hero-sub { color: var(--text-muted); margin-top: 4px; font-size: 0.8rem; font-weight: 500; }
.hero-stats { display: flex; gap: 20px; }
.hero-stat { text-align: right; }
.hero-stat-num { font-family: 'Syne', sans-serif; font-size: 1.4rem; font-weight: 800; color: var(--accent); line-height: 1; margin-bottom: 2px; }
.hero-stat-label { font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* STAT GRID */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px; transition: all 0.2s; }
.stat-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.stat-icon { font-size: 1.1rem; margin-bottom: 6px; }
.stat-num { font-family: 'Syne', sans-serif; font-size: 1.4rem; font-weight: 700; }
.stat-num.green { color: var(--green); }
.stat-num.red { color: var(--red); }
.stat-num.yellow { color: var(--yellow); }
.stat-num.blue { color: var(--accent); }
.stat-label { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }

/* LAYOUT */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 24px; }
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.kelompok-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

/* CARD */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px; }
.card-title { font-family: 'Syne', sans-serif; font-size: 0.85rem; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 14px; }
.kelompok-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; transition: all 0.2s; }
.kelompok-card:hover { border-color: var(--accent); transform: translateY(-2px); }

/* LEADERBOARD */
.lb-item { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid transparent; border-bottom: 1px solid var(--border); transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1); border-radius: 12px; margin-bottom: 8px; background: var(--surface); }
.lb-item:last-child { border-bottom: none; }
.lb-item:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.06); border-color: rgba(59,130,246,0.2); }
.lb-item.top-1 { background: linear-gradient(to right, rgba(251,191,36,0.1), transparent); border-left: 4px solid #fbbf24; border-bottom: none; }
.lb-item.top-2 { background: linear-gradient(to right, rgba(148,163,184,0.1), transparent); border-left: 4px solid #94a3b8; border-bottom: none; }
.lb-item.top-3 { background: linear-gradient(to right, rgba(217,119,6,0.1), transparent); border-left: 4px solid #d97706; border-bottom: none; }
.lb-rank { font-family: 'Syne', sans-serif; font-size: 1.1rem; font-weight: 800; width: 28px; text-align: center; }
.lb-rank.r1 { font-size: 1.4rem; filter: drop-shadow(0 2px 4px rgba(251,191,36,0.4)); }
.lb-rank.r2 { font-size: 1.3rem; filter: drop-shadow(0 2px 4px rgba(148,163,184,0.4)); }
.lb-rank.r3 { font-size: 1.2rem; filter: drop-shadow(0 2px 4px rgba(217,119,6,0.4)); }
.lb-rank.other { color: var(--text-muted); font-size: 0.85rem; background: var(--surface2); width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto; }
.lb-avatar { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1rem; font-weight: 700; flex-shrink: 0; box-shadow: 0 4px 10px rgba(0,0,0,0.05); }
.lb-info { flex: 1; min-width: 0; }
.lb-name { font-weight: 700; font-size: 0.95rem; color: var(--text); }
.lb-bar { height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.lb-bar-fill { height: 100%; border-radius: 99px; transition: width 1s ease-out; }
.lb-meta { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; font-weight: 500; }
.lb-score { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 1.1rem; padding: 4px 12px; border-radius: 8px; background: var(--surface2); }
.top-1 .lb-score { background: rgba(251,191,36,0.15); color: #b45309 !important; box-shadow: 0 4px 12px rgba(251,191,36,0.2); }
.top-2 .lb-score { background: rgba(148,163,184,0.15); color: #334155 !important; }
.top-3 .lb-score { background: rgba(217,119,6,0.15); color: #92400e !important; }

/* TABLE */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; font-size: 0.7rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.data-table td { padding: 11px 12px; border-bottom: 1px solid var(--border); font-size: 0.84rem; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(59,130,246,0.04); }
.name-cell { font-weight: 600; }

/* BADGE */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font-size: 0.72rem; font-weight: 600; }
.badge.green { background: rgba(16,185,129,0.15); color: var(--green); }
.badge.red { background: rgba(239,68,68,0.15); color: var(--red); }
.badge.yellow { background: rgba(245,158,11,0.15); color: var(--yellow); }
.badge.blue { background: rgba(59,130,246,0.15); color: var(--accent); }
.badge.purple { background: rgba(139,92,246,0.15); color: var(--purple); }

/* INNER TABS */
.inner-tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.inner-tab { padding: 5px 12px; border-radius: 6px; border: none; background: transparent; color: var(--text-muted); cursor: pointer; font-family: 'DM Sans', sans-serif; font-size: 0.82rem; font-weight: 500; transition: all 0.2s; }
.inner-tab.active { background: rgba(59,130,246,0.15); color: var(--accent); }

/* TIMELINE */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.tl-item { position: relative; margin-bottom: 18px; }
.tl-dot { position: absolute; left: -22px; top: 4px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--accent); background: var(--bg); }
.tl-dot.done { background: var(--accent); }
.tl-dot.aktif { background: var(--green); border-color: var(--green); box-shadow: 0 0 8px rgba(16,185,129,0.5); }
.tl-dot.selesai { background: var(--accent); }

/* FORMS */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
label { font-size: 0.78rem; color: var(--text-muted); font-weight: 500; }
input, select, textarea { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; color: var(--text); padding: 9px 12px; font-family: 'DM Sans', sans-serif; font-size: 0.88rem; outline: none; transition: border-color 0.2s; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
select option { background: var(--surface2); }
textarea { resize: vertical; min-height: 80px; }

/* BUTTONS */
.btn { padding: 9px 18px; border-radius: 8px; border: none; cursor: pointer; font-family: 'DM Sans', sans-serif; font-weight: 600; font-size: 0.86rem; transition: all 0.2s; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: #2563eb; }
.btn-success { background: var(--green); color: white; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-ghost { background: var(--surface2); color: var(--text-dim); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* SEARCH BAR */
.search-bar { display: flex; gap: 10px; margin-bottom: 14px; }
.search-bar input { flex: 1; }
.search-bar select { min-width: 160px; }

/* MISC */
.back-btn { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 0.84rem; cursor: pointer; margin-bottom: 18px; text-decoration: none; }
.back-btn:hover { color: var(--text); }
.detail-header { background: linear-gradient(135deg, rgba(59,130,246,0.08), rgba(6,182,212,0.04)); border: 1px solid rgba(59,130,246,0.2); border-radius: 14px; padding: 22px; margin-bottom: 22px; }

/* AUTH */
.auth-body { display: flex; align-items: center; justify-content: center; background: var(--bg); min-height: 100vh; }
.auth-wrap { width: 100%; max-width: 380px; padding: 20px; }
.auth-logo { text-align: center; margin-bottom: 24px; }

/* EXPLORE CAROUSEL */
.explore-section { margin-bottom: 24px; }
.explore-title { font-family: 'Syne', sans-serif; font-size: 1.1rem; font-weight: 700; color: var(--text); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.explore-carousel { display: flex; overflow-x: auto; gap: 16px; padding-bottom: 12px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.explore-carousel::-webkit-scrollbar { display: none; }
.explore-card { flex: 0 0 280px; scroll-snap-align: start; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; transition: all 0.2s; box-shadow: 0 4px 10px rgba(0,0,0,0.02); position: relative; overflow: hidden; }
.explore-card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: 0 8px 24px rgba(59,130,246,0.1); }
.explore-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; margin-bottom: 14px; }
.explore-card-title { font-weight: 700; font-size: 0.95rem; margin-bottom: 6px; color: var(--text); }
.explore-card-desc { font-size: 0.8rem; color: var(--text-muted); line-height: 1.5; flex: 1; }
.explore-tag { position: absolute; top: 16px; right: 16px; font-size: 0.65rem; font-weight: 700; padding: 3px 8px; border-radius: 99px; text-transform: uppercase; letter-spacing: 0.05em; }

.bg-jurusan { background: rgba(59,130,246,0.1); color: var(--accent); }
.bg-ekskul { background: rgba(139,92,246,0.1); color: var(--purple); }
.tag-jurusan { background: rgba(59,130,246,0.15); color: var(--accent); }
.tag-ekskul { background: rgba(139,92,246,0.15); color: var(--purple); }

/* ══════════════════════════════════════════
   RESPONSIVE — TABLET (max 900px)
══════════════════════════════════════════ */
@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col, .three-col, .kelompok-grid { grid-template-columns: 1fr; }
  .hero { flex-direction: column; gap: 16px; }
  .hero-stats { justify-content: flex-start; }
  .form-row { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════
   RESPONSIVE — MOBILE (max 640px)
══════════════════════════════════════════ */
@media (max-width: 640px) {
  /* Explore */
  .explore-card { flex: 0 0 240px; padding: 16px; }
  .explore-icon { width: 38px; height: 38px; font-size: 1.2rem; }
  
  /* Sidebar slide */
  .sidebar { transform: translateX(-100%); transition: transform 0.3s ease; }
  .sidebar.show { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,0.18); }
  .main-wrap { margin-left: 0; }
  #mobileMenuBtn { display: block !important; }

  /* Topbar */
  .topbar { padding: 0 14px; }
  .topbar-title { font-size: 0.88rem; }

  /* Content padding */
  .content { padding: 14px 12px; }

  /* Hero */
  .hero { padding: 18px 16px; border-radius: 12px; }
  .hero-title { font-size: 1.15rem; }
  .hero-stat-num { font-size: 1.3rem; }

  /* Stat grid → 2 col on mobile */
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-num { font-size: 1.5rem; }

  /* Cards */
  .card { padding: 14px 12px; border-radius: 10px; }
  .card-title { font-size: 0.8rem; }

  /* Tables → horizontal scroll */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 520px; }
  .data-table th, .data-table td { padding: 9px 10px; font-size: 0.8rem; }

  /* Forms */
  .form-row { grid-template-columns: 1fr; gap: 10px; }
  input, select, textarea { font-size: 0.9rem; padding: 10px 11px; }
  .btn { padding: 9px 14px; font-size: 0.82rem; }

  /* Search bar stack */
  .search-bar { flex-direction: column; gap: 8px; }
  .search-bar input, .search-bar select { width: 100%; min-width: unset; }

  /* Two / three col → single */
  .two-col, .three-col, .kelompok-grid { grid-template-columns: 1fr; gap: 12px; }

  /* Leaderboard tighter */
  .lb-item { gap: 8px; padding: 8px 0; }
  .lb-rank { font-size: 0.9rem; width: 22px; }
  .lb-avatar { width: 30px; height: 30px; font-size: 0.78rem; }
  .lb-name { font-size: 0.82rem; }
  .lb-score { font-size: 0.9rem; }

  /* Badges */
  .badge { font-size: 0.67rem; padding: 2px 7px; }

  /* Detail header */
  .detail-header { padding: 14px 12px; border-radius: 10px; margin-bottom: 14px; }

  /* Flash messages */
  .flash { margin: 0 0 12px 0; padding: 10px 14px; font-size: 0.82rem; border-radius: 8px; }

  /* Inner tabs scroll */
  .inner-tabs { overflow-x: auto; flex-wrap: nowrap; gap: 2px; padding-bottom: 6px; }
  .inner-tab { white-space: nowrap; font-size: 0.78rem; padding: 5px 10px; }

  /* Absensi: radio buttons row wrap */
  .radio-group { flex-wrap: wrap; gap: 4px; }

  /* Fix table action buttons overflow */
  .data-table td form, .data-table td a { display: inline-flex; }
}

/* ══════════════════════════════════════════
   TABLE WRAPPER — for all pages
══════════════════════════════════════════ */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 10px;
}

/* ══════════════════════════════════════════
   MOBILE NAV OVERLAY
══════════════════════════════════════════ */
#sidebarOverlay { cursor: pointer; }

/* ══════════════════════════════════════════
   PUSAT INFORMASI TABS — mobile
══════════════════════════════════════════ */
@media (max-width: 640px) {
  /* Tab buttons scroll horizontally */
  div[style*="border-bottom:2px solid"] {
    overflow-x: auto;
    flex-wrap: nowrap;
  }
  /* Stat quick-cards stack */
  div[style*="grid-template-columns:repeat(3,1fr)"] {
    grid-template-columns: 1fr !important;
    gap: 8px;
  }
  /* Admin buttons wrap */
  div[style*="display:flex;gap:8px;flex-wrap:wrap"] { gap: 6px; }
}

/* ══════════════════════════════════════════
   ABSENSI SHOLAT — mobile grid
══════════════════════════════════════════ */
@media (max-width: 640px) {
  .sholat-grid { grid-template-columns: 1fr !important; }
  .rekap-grid  { grid-template-columns: repeat(2,1fr) !important; }
}

