:root {
  --ink: #0f172a;
  --ink-muted: #475569;
  --teal: #0f766e;
  --teal-dark: #0d5e58;
  --teal-light: #14b8a6;
  --mint: #e4f4ee;
  --amber: #f4b942;
  --amber-dark: #b45309;
  --paper: #f8fafc;
  --white: #ffffff;
  --line: #e2e8f0;
  --danger: #b91c1c;
  --success: #15803d;
  --shadow: 0 18px 40px rgba(15, 118, 110, 0.08);
  --shadow-lg: 0 25px 60px rgba(15, 23, 42, 0.15);
  --radius: 16px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.container {
  width: min(1240px, calc(100% - 48px));
  margin: auto;
}

/* Utilities */
.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--teal);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.eyebrow::before {
  content: "";
  width: 24px;
  height: 2px;
  background: var(--amber);
}

.btn {
  border: 0;
  min-height: 46px;
  border-radius: var(--radius-sm);
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 0.92rem;
  font-weight: 700;
  transition: all 0.2s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--teal);
  color: var(--white);
  box-shadow: 0 8px 20px rgba(15, 118, 110, 0.25);
}
.btn-primary:hover { background: var(--teal-dark); }

.btn-secondary {
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--teal);
}
.btn-secondary:hover { background: var(--mint); border-color: var(--teal-light); }

.btn-dark {
  background: var(--ink);
  color: var(--white);
}
.btn-dark:hover { background: #1e293b; }

.btn-danger {
  background: var(--danger);
  color: var(--white);
}

.btn-sm {
  min-height: 36px;
  padding: 0 14px;
  font-size: 0.82rem;
}

/* Header & Nav */
header.app-header {
  height: 78px;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--line);
}
.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 900;
  letter-spacing: -0.04em;
  font-size: 1.3rem;
  color: var(--ink);
}
.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--teal);
  color: var(--amber);
  display: grid;
  place-items: center;
  font-family: Georgia, serif;
  font-size: 1.4rem;
  box-shadow: 0 6px 14px rgba(15, 118, 110, 0.3);
}
.brand-text small {
  display: block;
  font-size: 0.55rem;
  letter-spacing: 0.18em;
  color: var(--ink-muted);
  margin-top: -3px;
  font-weight: 700;
}

.nav-menu {
  display: flex;
  gap: 28px;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink-muted);
}
.nav-menu a:hover, .nav-menu a.active { color: var(--teal); }

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--mint);
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--teal-dark);
}
.user-badge .role-tag {
  background: var(--teal);
  color: var(--white);
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 0.7rem;
  text-transform: uppercase;
}

/* Main Views */
.view-section { display: none; padding: 40px 0 80px; }
.view-section.active { display: block; }

/* Hero Section */
.hero {
  padding: 60px 0 40px;
  position: relative;
  overflow: hidden;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 50px;
  align-items: center;
}
.hero h1 {
  font-size: clamp(2.5rem, 5vw, 4.2rem);
  line-height: 1.05;
  letter-spacing: -0.05em;
  margin: 16px 0 20px;
  color: var(--ink);
}
.hero h1 em {
  font-family: Georgia, serif;
  font-style: normal;
  color: var(--teal);
}
.hero-desc {
  font-size: 1.1rem;
  color: var(--ink-muted);
  max-width: 580px;
  margin-bottom: 30px;
}
.hero-stats {
  display: flex;
  gap: 24px;
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.stat-item b {
  display: block;
  font-size: 1.4rem;
  color: var(--ink);
  letter-spacing: -0.03em;
}
.stat-item span {
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.hero-card-preview {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-lg);
  position: relative;
  transform: rotate(2deg);
  transition: transform 0.3s ease;
}
.hero-card-preview:hover { transform: rotate(0deg); }
.preview-tag {
  display: inline-block;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 99px;
  margin-bottom: 14px;
}
.hero-card-preview h3 {
  font-size: 1.4rem;
  margin: 0 0 10px;
  letter-spacing: -0.03em;
}
.hero-card-preview p {
  color: var(--ink-muted);
  font-size: 0.88rem;
  margin: 0 0 20px;
}

/* Filter Bar */
.filter-bar {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 40px;
  box-shadow: var(--shadow);
}
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.chip {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-muted);
  padding: 8px 16px;
  border-radius: 99px;
  font-size: 0.82rem;
  font-weight: 700;
  transition: all 0.2s;
}
.chip:hover, .chip.active {
  background: var(--teal);
  color: var(--white);
  border-color: var(--teal);
}

/* Activity Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}
.event-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s, box-shadow 0.25s;
}
.event-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}
.event-poster {
  height: 160px;
  padding: 20px;
  color: var(--white);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.event-poster.cbt { background: linear-gradient(135deg, #0f766e, #0d5e58); }
.event-poster.webinar { background: linear-gradient(135deg, #1e40af, #1d4ed8); }
.event-poster.offline { background: linear-gradient(135deg, #991b1b, #b91c1c); }
.event-poster.private { background: linear-gradient(135deg, #581c87, #7e22ce); }

.poster-cat {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.9;
}
.poster-headline {
  font-family: Georgia, serif;
  font-size: 1.35rem;
  line-height: 1.1;
}

.event-content {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--success);
  background: #dcfce7;
  padding: 4px 10px;
  border-radius: 99px;
  margin-bottom: 12px;
  width: fit-content;
}
.status-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.event-title {
  font-size: 1.05rem;
  font-weight: 800;
  margin: 0 0 10px;
  line-height: 1.25;
}
.event-meta {
  font-size: 0.8rem;
  color: var(--ink-muted);
  display: grid;
  gap: 4px;
  margin-bottom: 20px;
}

.event-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.event-price {
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--ink);
}

/* Dashboard Layout */
.dashboard-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 32px;
  align-items: start;
}
.dash-sidebar {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 14px;
}
.dash-menu {
  display: grid;
  gap: 6px;
}
.dash-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink-muted);
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
}
.dash-menu-item:hover, .dash-menu-item.active {
  background: var(--mint);
  color: var(--teal-dark);
}

.dash-panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.panel-header h2 { margin: 0; font-size: 1.4rem; letter-spacing: -0.03em; }

/* Timeline Stepper */
.stepper {
  display: flex;
  justify-content: space-between;
  margin: 24px 0;
  position: relative;
}
.stepper::before {
  content: "";
  position: absolute;
  top: 14px;
  left: 20px;
  right: 20px;
  height: 3px;
  background: var(--line);
  z-index: 1;
}
.step-node {
  position: relative;
  z-index: 2;
  background: var(--white);
  padding: 0 8px;
  text-align: center;
}
.step-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--line);
  color: var(--ink-muted);
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 800;
  margin: auto auto 8px;
}
.step-node.completed .step-circle { background: var(--teal); color: var(--white); }
.step-node.active .step-circle { background: var(--amber); color: var(--ink); box-shadow: 0 0 0 4px var(--mint); }
.step-label { font-size: 0.74rem; font-weight: 700; color: var(--ink-muted); }

/* CBT Exam Room */
.exam-room-body { background: #0f172a; color: #f8fafc; min-height: 100vh; }
.exam-header {
  height: 64px;
  background: #1e293b;
  border-bottom: 1px solid #334155;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.exam-timer {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #0f172a;
  padding: 6px 16px;
  border-radius: 99px;
  border: 1px solid #334155;
  color: var(--amber);
  font-weight: 800;
  font-family: monospace;
  font-size: 1.1rem;
}
.exam-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  padding: 24px;
  max-width: 1300px;
  margin: auto;
}
.question-box {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: var(--radius);
  padding: 32px;
}
.q-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  font-size: 0.85rem;
  color: #94a3b8;
}
.q-text {
  font-size: 1.15rem;
  line-height: 1.5;
  margin-bottom: 28px;
}
.options-list {
  display: grid;
  gap: 12px;
}
.option-item {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.option-item:hover { border-color: var(--teal-light); }
.option-item.selected {
  background: rgba(15, 118, 110, 0.2);
  border-color: var(--teal-light);
  color: var(--white);
}
.option-item input { display: none; }
.opt-key {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid #475569;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 800;
}
.option-item.selected .opt-key {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--white);
}

.essay-editor {
  width: 100%;
  min-height: 160px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: var(--radius-sm);
  color: #fff;
  padding: 16px;
  resize: vertical;
}

.q-nav-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}
.q-nav-btn {
  height: 42px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #94a3b8;
  font-weight: 800;
  font-size: 0.9rem;
}
.q-nav-btn.answered { background: var(--teal); color: var(--white); border-color: var(--teal); }
.q-nav-btn.flagged { background: var(--amber); color: var(--ink); border-color: var(--amber); }
.q-nav-btn.current { ring: 2px solid var(--white); }

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  place-items: center;
  z-index: 200;
  padding: 20px;
}
.modal-overlay.active { display: grid; }
.modal-card {
  background: var(--white);
  border-radius: var(--radius);
  width: min(100%, 600px);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 32px;
  box-shadow: var(--shadow-lg);
  position: relative;
}
.modal-close {
  position: absolute;
  right: 20px;
  top: 20px;
  border: 0;
  background: var(--paper);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.2rem;
  color: var(--ink-muted);
}

.form-group {
  margin-bottom: 18px;
}
.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 800;
  margin-bottom: 6px;
  color: var(--ink);
}
.form-control {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  font-size: 0.92rem;
  background: var(--white);
  color: var(--ink);
}
.form-control:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--mint);
}

/* Certificate Preview Card */
.cert-document {
  background: #fff;
  border: 8px solid var(--teal);
  padding: 40px;
  text-align: center;
  position: relative;
  box-shadow: var(--shadow-lg);
  border-radius: 8px;
}
.cert-header {
  font-family: Georgia, serif;
  font-size: 1.8rem;
  color: var(--teal-dark);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}
.cert-recipient {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--ink);
  margin: 16px 0;
  text-decoration: underline;
  text-decoration-color: var(--amber);
}
.cert-footer-signatures {
  display: flex;
  justify-content: space-around;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px dashed var(--line);
}
.sig-block b { display: block; font-size: 0.9rem; }
.sig-block span { font-size: 0.78rem; color: var(--ink-muted); }

/* CBT Ragu-ragu (Flagged) state */
.q-nav-btn.flagged {
  background: #fef08a !important;
  color: #854d0e !important;
  border-color: #facc15 !important;
  font-weight: 800;
}

/* Metric Cards Grid */
.metric-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.metric-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 20px;
  box-shadow: var(--shadow);
}
.metric-card b {
  display: block;
  font-size: 1.8rem;
  color: var(--teal-dark);
}
.metric-card span {
  font-size: 0.85rem;
  color: var(--ink-muted);
}

/* Admin Sidebar Layout System */
.admin-app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  align-items: start;
}
.admin-sidebar {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 14px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 98px;
}
.admin-sidebar-header {
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.admin-sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.admin-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-muted);
  background: transparent;
  border: 0;
  width: 100%;
  text-align: left;
  transition: all 0.2s ease;
}
.admin-nav-item:hover {
  background: var(--mint);
  color: var(--teal-dark);
}
.admin-nav-item.active {
  background: var(--teal);
  color: var(--white);
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.2);
}
.admin-nav-badge {
  background: rgba(255,255,255,0.25);
  color: inherit;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 800;
}
.admin-nav-item:not(.active) .admin-nav-badge {
  background: var(--line);
  color: var(--ink);
}
.admin-main-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.admin-tab-pane {
  display: none;
}
.admin-tab-pane.active {
  display: block;
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .hero-grid, .dashboard-layout, .exam-layout { grid-template-columns: 1fr; }
  .admin-app-shell { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; }
  .nav-menu { display: none; }
  .cards-grid { grid-template-columns: 1fr; }
}
