:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary: #64748b;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --radius: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.hidden { display: none !important; }

.app-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand { display: flex; align-items: center; gap: 0.75rem; }
.brand h1 { font-size: 1.15rem; }
.subtitle { font-size: 0.85rem; color: var(--muted); }
.logo { height: 40px; width: 40px; object-fit: contain; }

.container { max-width: 1100px; margin: 2rem auto; padding: 0 1rem; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.login-card { max-width: 440px; margin: 3rem auto; }

.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; }
.tab-btn {
  flex: 1;
  padding: 0.75rem;
  border: none;
  background: transparent;
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.875rem; font-weight: 600; margin-bottom: 0.35rem; }
input[type="text"], input[type="password"], input[type="number"], select, textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
}

.btn {
  padding: 0.65rem 1.1rem;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
  transition: opacity 0.15s;
}
.btn:hover { opacity: 0.92; }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.82rem; }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }

.badge {
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: #e0e7ff;
  color: var(--primary);
}
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-success { background: #dcfce7; color: #15803d; }
.badge-danger { background: #fee2e2; color: #b91c1c; }

.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }
.inline-form { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.inline-form input { flex: 1; min-width: 180px; }

/* Ruang Ujian */
.exam-workspace { max-width: 1200px; margin: 1rem auto; padding: 0 1rem; }
.exam-topbar {
  background: var(--card);
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}
.exam-status-bar { display: flex; align-items: center; gap: 0.75rem; }
.timer-box {
  font-family: monospace;
  font-size: 1.15rem;
  font-weight: 700;
  background: #0f172a;
  color: #fff;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
}

.exam-body { display: grid; grid-template-columns: 1fr 260px; gap: 1rem; }
@media (max-width: 820px) { .exam-body { grid-template-columns: 1fr; } }

.question-meta {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
  font-weight: 600;
}
.question-content { font-size: 1.05rem; margin-bottom: 1.25rem; }
.question-content img, .option-item img { max-width: 100%; border-radius: 6px; margin-top: 0.5rem; display: block; }

.option-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.65rem;
  cursor: pointer;
}
.option-item:hover { background: #f8fafc; }
.option-item.selected { border-color: var(--primary); background: #eff6ff; }

.question-nav-buttons { display: flex; justify-content: space-between; margin-top: 1.5rem; }

.question-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.45rem; margin-top: 0.75rem; }
.q-num-btn {
  padding: 0.5rem 0;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}
.q-num-btn.answered { background: var(--success); color: #fff; border-color: var(--success); }
.q-num-btn.current { outline: 2px solid var(--primary); }

/* Tabel & Staf */
.staff-nav { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.staff-tab {
  padding: 0.6rem 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}
.staff-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.65rem; border-bottom: 1px solid var(--border); }
th { background: #f8fafc; }

.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: #0f172a;
  color: #fff;
  padding: 0.85rem 1.25rem;
  border-radius: 8px;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
