/* ============================================================
   ALMAHIRU — Design System & Global Styles (Multi-Role Platform)
   ============================================================ */

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

/* ── CSS Variables ─────────────────────────────────── */
:root {
  --primary: #10b981;
  --primary-dark: #047857;
  --primary-mid: #059669;
  --primary-light: #34d399;
  --primary-pale: #ecfdf5;
  --accent-gold: #f59e0b;
  --accent-gold-lt: #fffbeb;
  --accent-fire: #ef4444;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --text: #0f172a;
  --text-sub: #475569;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .08);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, .10);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, .12);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --nav-h: 68px;
  --header-h: 60px;
  --transition: all .25s cubic-bezier(.4, 0, .2, 1);
}

/* ── Reset ─────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  font-family: 'Poppins', sans-serif;
  background: #0f172a;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ── Utility Classes ────────────────────────────────── */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-1 {
  flex: 1;
}

.flex-wrap {
  flex-wrap: wrap;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-around {
  justify-content: space-around;
}

.gap-4 {
  gap: 4px;
}

.gap-6 {
  gap: 6px;
}

.gap-8 {
  gap: 8px;
}

.gap-10 {
  gap: 10px;
}

.gap-12 {
  gap: 12px;
}

.gap-16 {
  gap: 16px;
}

.gap-20 {
  gap: 20px;
}

.gap-24 {
  gap: 24px;
}

.mt-4 {
  margin-top: 4px;
}

.mt-6 {
  margin-top: 6px;
}

.mt-8 {
  margin-top: 8px;
}

.mt-12 {
  margin-top: 12px;
}

.mt-16 {
  margin-top: 16px;
}

.mt-20 {
  margin-top: 20px;
}

.mt-24 {
  margin-top: 24px;
}

.mb-4 {
  margin-bottom: 4px;
}

.mb-8 {
  margin-bottom: 8px;
}

.mb-12 {
  margin-bottom: 12px;
}

.mb-16 {
  margin-bottom: 16px;
}

.mb-20 {
  margin-bottom: 20px;
}

.mb-24 {
  margin-bottom: 24px;
}

.p-8 {
  padding: 8px;
}

.p-12 {
  padding: 12px;
}

.p-16 {
  padding: 16px;
}

.p-20 {
  padding: 20px;
}

.p-24 {
  padding: 24px;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-left {
  text-align: left;
}

.w-full {
  width: 100%;
}

.h-full {
  height: 100%;
}

.relative {
  position: relative;
}

.absolute {
  position: absolute;
}

.hidden {
  display: none !important;
}

.sub-text {
  font-size: 12px;
  color: var(--text-muted);
}

.danger-text {
  color: #ef4444;
}

/* ── Page Layout ────────────────────────────────────── */
.page {
  min-height: calc(100vh - 130px);
  padding-bottom: 80px;
  background: var(--bg);
}

.p-page {
  padding: 16px;
  padding-bottom: 90px;
}

.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-header h2 {
  font-size: 17px;
  font-weight: 700;
  flex: 1;
}

.btn-back {
  background: none;
  border: none;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background .2s;
}

.btn-back:hover {
  background: var(--border);
}

.btn-back svg {
  width: 20px;
  height: 20px;
  stroke: var(--text);
}

/* ── Input Field ────────────────────────────────────── */
.input-field {
  width: 100%;
  background: #f8fafc;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color .2s;
}

.input-field:focus {
  border-color: var(--primary);
  background: #fff;
}

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

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-sub);
  margin-bottom: 6px;
}

/* ── App Shell (Responsive Container) ──────────────── */
#app {
  position: relative;
  min-height: 100vh;
  max-width: 768px;
  margin: 0 auto;
  background: var(--bg);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
}

@media (min-width: 1024px) {
  #app {
    max-width: 1080px;
  }
}

/* ── Top Role Switcher Header ──────────────────────── */
#top-role-header {
  sticky: top 0;
  position: sticky;
  top: 0;
  z-index: 200;
  background: #0f172a;
  color: #fff;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-logo {
  font-size: 22px;
}

.brand-title {
  font-weight: 800;
  font-size: 17px;
  color: #fff;
  letter-spacing: -0.5px;
}

.brand-badge {
  font-size: 10px;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
}

.role-switcher-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.role-lbl {
  font-size: 12px;
  font-weight: 500;
  color: #94a3b8;
}

.role-dropdown {
  background: #1e293b;
  color: #38bdf8;
  border: 1.5px solid #334155;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}

.role-dropdown:hover {
  border-color: #38bdf8;
}

/* ── Page Container ────────────────────────────────── */
#page-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: var(--nav-h);
}

/* ── Bottom Navigation ─────────────────────────────── */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 768px;
  height: var(--nav-h);
  background: #ffffff;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, .08);
}

@media (min-width: 1024px) {
  #bottom-nav {
    max-width: 1080px;
  }
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  transition: var(--transition);
  position: relative;
  color: var(--text-muted);
}

.nav-item svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  transition: var(--transition);
}

.nav-item span {
  font-size: 11px;
  font-weight: 600;
}

.nav-item.active {
  color: var(--primary-dark);
}

.nav-item.active svg {
  stroke: var(--primary-dark);
}

.nav-indicator {
  position: absolute;
  top: 0;
  width: 24px;
  height: 3px;
  background: var(--primary);
  border-radius: 0 0 4px 4px;
  opacity: 0;
  transition: var(--transition);
}

.nav-item.active .nav-indicator {
  opacity: 1;
}

/* ── Role Banners & Dashboards ─────────────────────── */
.role-banner {
  padding: 24px 20px;
  color: #fff;
  border-radius: 0 0 20px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.admin-banner {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  border-bottom: 3px solid #38bdf8;
}

.pic-banner {
  background: linear-gradient(135deg, #065f46 0%, #047857 100%);
  border-bottom: 3px solid #34d399;
}

.pengajar-banner {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
  border-bottom: 3px solid #a78bfa;
}

.role-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.15);
  padding: 3px 10px;
  border-radius: 12px;
  margin-bottom: 6px;
}

.banner-info h2 {
  font-size: 22px;
  font-weight: 800;
}

.banner-info p {
  font-size: 12px;
  opacity: 0.85;
  margin-top: 2px;
}

.banner-stat-pills {
  display: flex;
  gap: 10px;
}

.stat-pill {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  padding: 8px 14px;
  border-radius: 12px;
  text-align: center;
  min-width: 80px;
}

.stat-pill .num {
  display: block;
  font-size: 18px;
  font-weight: 800;
}

.stat-pill .lbl {
  font-size: 10px;
  opacity: 0.8;
}

/* ── Metrics Cards Grid ────────────────────────────── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  padding: 16px 20px;
}

.metric-card {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.metric-card.gold {
  border-left: 4px solid var(--accent-gold);
}

.metric-card.emerald {
  border-left: 4px solid var(--primary);
}

.metric-card.blue {
  border-left: 4px solid var(--accent-blue);
}

.metric-card.purple {
  border-left: 4px solid var(--accent-purple);
}

.metric-icon {
  font-size: 28px;
}

.metric-data .val {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
}

.metric-data .lbl {
  font-size: 11px;
  color: var(--text-sub);
}

/* ── Admin & PIC Section Tables ─────────────────────── */
.admin-section,
.pic-section,
.pengajar-section {
  padding: 16px 20px;
}

.section-header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-header-flex h3 {
  font-size: 16px;
  font-weight: 800;
}

.section-header-flex p {
  font-size: 12px;
  color: var(--text-sub);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.admin-table th {
  background: #f1f5f9;
  padding: 12px 16px;
  font-weight: 700;
  color: var(--text-sub);
  border-bottom: 1px solid var(--border);
}

.admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.program-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.program-cell .p-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.sub-text {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-avatar-sm {
  font-size: 20px;
}

/* ── Badges ────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.badge-gray {
  background: #f1f5f9;
  color: #475569;
}

.badge-emerald {
  background: #d1fae5;
  color: #065f46;
}

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

.badge-success {
  background: #dcfce7;
  color: #15803d;
}

.fire-badge {
  background: #fee2e2;
  color: #b91c1c;
  font-weight: 700;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 11px;
}

.rating-badge {
  background: #fef9c3;
  color: #a16207;
  font-weight: 700;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 11px;
}

/* ── Buttons ───────────────────────────────────────── */
.btn {
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-primary {
  background: #2563eb;
  color: #fff;
}

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

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

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

.btn-outline:hover {
  background: #f8fafc;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 11px;
  border-radius: 8px;
}

.btn-block {
  width: 100%;
}

.btn-disabled {
  background: #e2e8f0;
  color: #94a3b8;
  cursor: not-allowed;
}

/* ── Cards Grid ────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.class-card {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.class-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.class-room {
  font-size: 11px;
  color: var(--text-sub);
}

.class-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
}

.class-meta {
  font-size: 12px;
  color: var(--text-sub);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.class-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

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

.student-card-item {
  background: #fff;
  border-radius: 14px;
  padding: 14px;
  border: 1px solid var(--border);
}

.student-main-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.avatar-box {
  font-size: 26px;
}

.student-badges-row {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

/* ── Gamification Engine Config Grid ────────────────── */
.gamification-config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.config-card {
  background: #fff;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
}

.config-card h4 {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
}

.config-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-field {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  font-size: 13px;
  font-family: inherit;
  outline: none;
}

.input-field:focus {
  border-color: var(--primary);
}

.help-text {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ── Grading Modal ──────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

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

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

.modal-header h3 {
  font-size: 16px;
  font-weight: 800;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-body {
  padding: 20px;
}

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

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-sub);
}

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

.aspect-rating-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 12px;
}

.aspect-rating-row input[type="range"] {
  flex: 1;
  accent-color: var(--primary);
}

.star-count {
  font-weight: 800;
  color: var(--accent-gold);
  width: 32px;
  text-align: right;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

/* ── Quests Page ────────────────────────────────────── */
.quest-header-banner {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  color: #fff;
  padding: 24px 20px;
  border-radius: 0 0 20px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.q-stats {
  display: flex;
  gap: 10px;
}

.q-stat-pill {
  background: rgba(255, 255, 255, 0.2);
  padding: 8px 12px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.q-stat-pill .icon {
  font-size: 20px;
}

.quests-container {
  padding: 20px;
}

.quest-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.quest-card {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
}

.quest-card.completed {
  border-color: var(--accent-gold);
  background: #fffbeb;
}

.quest-card.claimed {
  opacity: 0.7;
}

.quest-icon {
  font-size: 32px;
}

.quest-info {
  flex: 1;
}

.quest-info h4 {
  font-size: 14px;
  font-weight: 800;
}

.quest-info p {
  font-size: 11px;
  color: var(--text-sub);
}

.quest-rewards {
  display: flex;
  gap: 6px;
  margin: 6px 0;
}

.rw-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.rw-tag.xp {
  background: #dcfce7;
  color: #166534;
}

.rw-tag.coin {
  background: #fef3c7;
  color: #92400e;
}

.quest-progress-bar {
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 6px;
}

.q-fill {
  height: 100%;
  background: var(--accent-gold);
}

.q-ratio {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Shop Page ──────────────────────────────────────── */
.shop-header-banner {
  background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
  color: #fff;
  padding: 24px 20px;
  border-radius: 0 0 20px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.coin-balance-card {
  background: rgba(255, 255, 255, 0.25);
  padding: 10px 16px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.coin-balance-card .coin-icon {
  font-size: 28px;
}

.coin-balance-card .amount {
  font-size: 18px;
  font-weight: 800;
}

.shop-container {
  padding: 20px;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.shop-card {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  border: 1.5px solid var(--border);
  text-align: center;
}

.shop-card.purchased {
  border-color: var(--primary);
  background: #f0fdf4;
}

.shop-item-icon {
  font-size: 42px;
  margin-bottom: 8px;
}

.shop-item-info h4 {
  font-size: 14px;
  font-weight: 800;
}

.shop-item-info p {
  font-size: 11px;
  color: var(--text-sub);
  margin: 4px 0 10px;
}

.item-price {
  font-size: 14px;
  font-weight: 800;
  color: #b45309;
  margin-bottom: 12px;
}

/* ── Leaderboard Page ───────────────────────────────── */
.lb-header-banner {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
  color: #fff;
  padding: 24px 20px;
  border-radius: 0 0 20px 20px;
  text-align: center;
}

.podium-container {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 16px;
  padding: 24px 20px 10px;
}

.podium-step {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.podium-avatar {
  position: relative;
  font-size: 36px;
  margin-bottom: 6px;
}

.rank-crown {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 18px;
}

.podium-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.podium-xp {
  font-size: 11px;
  font-weight: 800;
  color: var(--primary);
}

.podium-base {
  width: 70px;
  border-radius: 12px 12px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
  margin-top: 6px;
}

.step-1 .podium-base {
  height: 90px;
  background: linear-gradient(180deg, #f59e0b, #d97706);
  font-size: 24px;
}

.step-2 .podium-base {
  height: 70px;
  background: linear-gradient(180deg, #94a3b8, #64748b);
  font-size: 20px;
}

.step-3 .podium-base {
  height: 50px;
  background: linear-gradient(180deg, #b45309, #78350f);
  font-size: 18px;
}

.lb-list-container {
  padding: 20px;
}

.lb-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.lb-item {
  background: #fff;
  border-radius: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.lb-item.current-user-lb {
  border: 2px solid var(--primary);
  background: #ecfdf5;
}

.lb-rank {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-sub);
  width: 28px;
}

.lb-avatar-box {
  font-size: 24px;
}

.lb-details {
  flex: 1;
}

.lb-name {
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.you-badge {
  background: var(--primary);
  color: #fff;
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 4px;
}

.lb-sub {
  font-size: 10px;
  color: var(--text-muted);
}

.lb-score {
  font-size: 14px;
  font-weight: 800;
  color: var(--primary-dark);
}

/* ── Green Header Area (Student Legacy) ───────────── */
.green-header {
  background: linear-gradient(135deg, #059669, #10b981);
  color: #fff;
  padding: 24px 20px 28px;
}

/* ── Toast ─────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #0f172a;
  color: #fff;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  z-index: 9999;
  opacity: 0;
  transition: var(--transition);
  pointer-events: none;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  border: 1px solid #334155;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Spinner ───────────────────────────────────────── */
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 40px auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Card Legacy Utilities ─────────────────────────── */
.card {
  background: #fff;
  border-radius: 14px;
  padding: 16px;
  border: 1px solid var(--border);
}

.card-elevated {
  box-shadow: var(--shadow-md);
}

.progress-track {
  background: #e2e8f0;
  border-radius: 6px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   ALMAHIRU — Production Superadmin Suite Styles
   ============================================================ */

.admin-production-suite {
  background: var(--bg);
  min-height: 100vh;
}

.admin-suite-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #fff;
  padding: 24px 20px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  border-bottom: 3px solid #38bdf8;
}

.gold-glow {
  background: linear-gradient(90deg, #f59e0b, #d97706);
  color: #fff;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}

.admin-profile-info h2 {
  font-size: 22px;
  font-weight: 800;
  margin-top: 4px;
}

.admin-profile-info p {
  font-size: 12px;
  color: #94a3b8;
}

.system-status-box {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 10px 16px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.status-indicator.online {
  background: #10b981;
  box-shadow: 0 0 10px #10b981;
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }

  70% {
    transform: scale(1);
    box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
  }

  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.sub-txt {
  font-size: 10px;
  color: #94a3b8;
}

/* ── Admin Tabs Nav ─────────────────────────────────── */
.admin-tabs-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #0f172a;
  padding: 10px 16px;
  overflow-x: auto;
  border-bottom: 1px solid #334155;
  scrollbar-width: none;
}

.admin-tabs-nav::-webkit-scrollbar {
  display: none;
}

.admin-tab-btn {
  background: #1e293b;
  color: #94a3b8;
  border: 1px solid #334155;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.admin-tab-btn:hover {
  color: #fff;
  border-color: #38bdf8;
}

.admin-tab-btn.active {
  background: #38bdf8;
  color: #0f172a;
  border-color: #38bdf8;
  font-weight: 800;
}

.admin-tab-body {
  padding-bottom: 40px;
}

.danger-text {
  color: #ef4444 !important;
  border-color: #fca5a5 !important;
}

.danger-text:hover {
  background: #fee2e2 !important;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 14px;
}

/* ── Student Enrollment Modal Lists ─────────────────── */
.enroll-section {
  margin-bottom: 12px;
}

.enrolled-students-list,
.available-students-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.enrolled-student-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #f1f5f9;
  border-radius: 10px;
  border: 1px solid var(--border);
}

/* ── Pengajar Multi-Class Pills & Attendance ─────────── */
.pengajar-class-pill {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 8px 14px;
  background: #f1f5f9;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.pengajar-class-pill.active {
  background: #ecfdf5;
  border-color: #059669;
  color: #047857;
}

.pengajar-class-pill .pill-title {
  font-weight: 700;
  font-size: 13px;
}

.pengajar-class-pill .pill-sub {
  font-size: 11px;
  opacity: 0.8;
  margin-top: 2px;
}

.attendance-btn-group {
  display: flex;
  gap: 4px;
}

.att-btn {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #ffffff;
  cursor: pointer;
  transition: all 0.15s ease;
}

.att-btn.hadir {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
  font-weight: 700;
}

.att-btn.izin {
  background: #fef9c3;
  border-color: #fde047;
  color: #854d0e;
  font-weight: 700;
}

.att-btn.sakit {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e40af;
  font-weight: 700;
}

.att-btn.alpa {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
  font-weight: 700;
}

/* ── History Journal Cards ──────────────────────────── */
.journal-card-item {
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.journal-card-item:hover {
  border-color: var(--primary-emerald);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.08);
}

.journal-avatar {
  font-size: 24px;
}

.journal-ustadz {
  font-size: 15px;
  margin: 0;
  color: var(--text-dark);
}

.journal-date {
  font-size: 12px;
  color: var(--text-muted);
}

.journal-scores-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}

.journal-score-pill {
  background: #f8fafc;
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
}

.journal-score-pill .lbl {
  color: var(--text-muted);
}

.journal-score-pill .val {
  font-weight: 700;
  color: var(--primary-dark);
}

.journal-guru-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 12px;
  color: #166534;
}

.journal-guru-note p {
  margin: 0;
}

/* ── Login & Demo Pills Styles ──────────────────────── */
.demo-account-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  width: 100%;
}

.demo-account-pill:hover {
  background: #ecfdf5;
  border-color: #059669;
  transform: translateY(-1px);
}

.demo-account-pill .pill-icon {
  font-size: 24px;
}

.demo-account-pill .pill-info {
  flex: 1;
}

.demo-account-pill .pill-info strong {
  display: block;
  font-size: 13px;
  color: var(--text-dark);
}

.demo-account-pill .pill-info .sub {
  font-size: 11px;
  color: var(--text-muted);
}

.demo-account-pill .pill-arrow {
  font-size: 16px;
  color: var(--primary-emerald);
  font-weight: 700;
}

/* ============================================================
   ALMAHIRU — Production PIC (Person In Charge) Suite Styles
   ============================================================ */

.pic-page {
  background: var(--bg);
  min-height: 100vh;
}

.pic-section {
  padding: 16px 20px;
  background: #fff;
  border-radius: 16px;
  margin: 16px 20px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.03);
}

.section-header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.section-header-flex h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-dark);
}

.section-header-flex p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

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

.class-card {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.class-card:hover {
  border-color: var(--primary-emerald);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.12);
}

.class-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.class-room {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: #f1f5f9;
  padding: 3px 8px;
  border-radius: 8px;
}

.class-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-dark);
  margin: 0;
}

.class-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  background: #f8fafc;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.class-meta div {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.class-meta span {
  color: var(--text-muted);
}

.class-card-actions {
  margin-top: 4px;
}

/* ── Admin & PIC Table Styles ───────────────────────── */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
  background: #fff;
}

.admin-table th {
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 14px;
  border-bottom: 1.5px solid var(--border);
}

.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-dark);
}

.admin-table tbody tr:last-child td {
  border-bottom: none;
}

.admin-table tbody tr:hover {
  background: #f0fdf4;
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar-sm {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.progress-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 12px;
  color: var(--primary-dark);
}

.fire-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fff7ed;
  color: #c2410c;
  font-weight: 700;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 10px;
  border: 1px solid #ffedd5;
}

.enroll-section {
  margin-top: 16px;
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  border: 1px solid var(--border);
}

/* ── Centered Modal Backdrop & Popups (Production Grade) ────────── */
.modal-backdrop,
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: modalFadeIn 0.25s ease-out forwards;
}

.modal-backdrop[style*="display: none"],
.modal-backdrop[style*="display:none"],
.modal-overlay[style*="display: none"],
.modal-overlay[style*="display:none"] {
  display: none !important;
}

.modal-box,
.modal-card {
  position: relative;
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 30px 70px -15px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.2);
  margin: auto;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalScaleUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalScaleUp {
  from { transform: scale(0.92) translateY(12px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

/* ── Mobile Responsive Enhancements (Smartphones / HP) ──────────── */
@media (max-width: 768px) {
  /* Page Containers on Mobile */
  .p-page,
  .page,
  .pengajar-suite-page,
  .admin-production-suite {
    padding: 14px 10px 90px !important;
  }

  .progress-page-container {
    padding-bottom: 110px !important;
  }

  /* Header Banners */
  .role-banner,
  .pengajar-banner {
    padding: 18px 14px !important;
    border-radius: 18px !important;
    margin-bottom: 14px !important;
  }

  .role-banner h2,
  .pengajar-banner h2 {
    font-size: 20px !important;
    line-height: 1.3 !important;
  }

  .role-banner p,
  .pengajar-banner p {
    font-size: 12px !important;
  }

  /* Modals: Perfectly Centered with Touch Margin */
  .modal-backdrop,
  .modal-overlay {
    padding: 8px !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .modal-box,
  .modal-card,
  #quick-grading-modal .modal-box,
  #student-progress-analytics-modal > div {
    max-height: 92vh !important;
    border-radius: 20px !important;
    margin: 4px auto !important;
    width: 96% !important;
    max-width: 540px !important;
    padding: 16px 14px !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  /* Tables: Smooth Horizontal Scroll on HP */
  .table-responsive {
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    border-radius: 14px !important;
    display: block !important;
    margin-bottom: 14px !important;
  }

  .admin-table th,
  .admin-table td {
    padding: 10px 12px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
  }

  /* Grids: Responsive 1-col or 2-col on Mobile */
  .grid-2,
  .grid-3,
  .grid-4,
  div[style*="grid-template-columns: 1fr 1fr"],
  div[style*="grid-template-columns:1fr 1fr"],
  div[style*="grid-template-columns:repeat(4, 1fr)"] {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)) !important;
    gap: 10px !important;
  }

  /* Tab direct switchers (scrollable pill bar) */
  .tabs-scroll-row,
  div[style*="overflow-x:auto"] {
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
  }
  div[style*="overflow-x:auto"]::-webkit-scrollbar {
    display: none !important;
  }

  /* Button Touch Targets */
  .btn {
    min-height: 38px !important;
    padding: 8px 14px !important;
    font-size: 13px !important;
    touch-action: manipulation !important;
  }

  /* Form Inputs on Mobile (prevent iOS auto zoom with 14-16px font) */
  .input-field,
  input,
  select,
  textarea {
    font-size: 13px !important;
    min-height: 40px !important;
  }

  /* Quran Grade Input Form on HP */
  div[style*="grid-template-columns:2fr 1fr 1fr"],
  div[style*="grid-template-columns: 2fr 1fr 1fr"] {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }
  div[style*="grid-template-columns:2fr 1fr 1fr"] > div:first-child,
  div[style*="grid-template-columns: 2fr 1fr 1fr"] > div:first-child {
    grid-column: span 2 !important;
  }

  /* Bottom Navigation */
  #bottom-nav {
    max-width: 100% !important;
    left: 0 !important;
    transform: none !important;
  }
  .nav-item {
    padding: 4px 6px !important;
  }
  .nav-item svg {
    width: 20px !important;
    height: 20px !important;
  }
  .nav-item span {
    font-size: 9.5px !important;
  }
}

/* Extra Small Phones (iPhone SE, Galaxy A, screens < 480px) */
@media (max-width: 480px) {
  .p-page,
  .page,
  .pengajar-suite-page {
    padding: 10px 8px 85px !important;
  }

  .role-banner,
  .pengajar-banner {
    padding: 14px 12px !important;
    border-radius: 16px !important;
  }

  .role-banner h2,
  .pengajar-banner h2 {
    font-size: 18px !important;
  }

  /* Modal Buttons stack vertically on tiny screens */
  #quick-grading-form div[style*="justify-content:flex-end"] {
    flex-direction: column-reverse !important;
    gap: 8px !important;
  }
  #quick-grading-form div[style*="justify-content:flex-end"] button {
    width: 100% !important;
  }

  /* Rubrik star rating inputs stack nicely */
  #star-rubrik-box div[style*="grid-template-columns:1fr 1fr"],
  #star-rubrik-box div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  /* Hafalan cards in progress page */
  div[style*="margin-top:-40px"] {
    margin-top: -24px !important;
    padding: 0 10px !important;
  }

  .login-right-panel {
    padding: 24px 14px !important;
  }
}

/* ── Landing Page Responsive ────────────────────────── */
@media (max-width: 768px) {
  .landing-progress-grid {
    grid-template-columns: 1fr !important;
  }
  .landing-hero h1 {
    font-size: 26px !important;
  }
  .landing-footer-grid {
    grid-template-columns: 1fr !important;
  }
  .landing-riwayat-row {
    grid-template-columns: 60px 1fr !important;
  }
  .landing-riwayat-row .col-catatan,
  .landing-riwayat-row .col-status {
    display: none !important;
  }
}

@media (max-width: 600px) {
  section[style*="padding:80px"] {
    padding: 52px 16px 60px !important;
  }
  section + div {
    flex-wrap: wrap !important;
  }
  div[style*="grid-template-columns:repeat(auto-fit,minmax(240px"] {
    grid-template-columns: 1fr !important;
  }
  div[style*="grid-template-columns:repeat(auto-fill,minmax(280px"] {
    grid-template-columns: 1fr !important;
  }
  div[style*="grid-template-columns:repeat(auto-fit,minmax(260px"] {
    grid-template-columns: 1fr !important;
  }
  section[style*="display:grid; grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  footer div[style*="grid-template-columns:1fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  nav[style*="padding:14px 32px"] {
    padding: 12px 16px !important;
  }
  section[style*="padding:70px 24px"] {
    padding: 48px 20px !important;
  }
}

/* ── Login Page Responsive ──────────────────────────── */
@media (max-width: 768px) {
  .login-left-panel {
    display: none !important;
  }
  .login-right-panel {
    width: 100% !important;
    min-height: 100vh;
    padding: 32px 20px !important;
  }
  .login-mobile-brand {
    display: block !important;
  }
}

@media (max-width: 480px) {
  .login-right-panel {
    padding: 24px 16px !important;
  }
}