﻿*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #FFF9F5;
  --bg2: #FFF3EA;
  --bg3: #FFEADB;
  --surface: #FFFFFF;
  --surface2: #FFF3EA;
  --border: rgba(232,100,12,0.15);
  --border-active: rgba(232,100,12,0.5);
  --primary: #E8640C;
  --primary-dark: #C4520A;
  --primary-light: #F4914A;
  --primary-glow: rgba(232,100,12,0.18);
  --brown: #3D2314;
  --brown-light: #7A5242;
  --accent: #C4520A;
  --accent2: #F4A156;
  --green: #2E7D32;
  --green-light: #43A047;
  --red: #C62828;
  --text: #2C1810;
  --text-muted: #7A5242;
  --text-dim: #BFA090;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(61,35,20,0.10);
  --shadow-md: 0 8px 32px rgba(61,35,20,0.14);
  --shadow-orange: 0 4px 20px rgba(232,100,12,0.22);
}
html { scroll-behavior: smooth; }
body {
  font-family: 'Noto Sans Thai', 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}
body::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 10% 0%, rgba(232,100,12,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 90% 90%, rgba(244,145,74,0.05) 0%, transparent 55%);
  pointer-events: none; z-index: 0;
}
@media print { body { display: none !important; } }
.page { display: none; min-height: 100vh; position: relative; z-index: 1; }
.page.active { display: flex; flex-direction: column; align-items: center; justify-content: center; }

/* ===== INTRO ===== */
#page-intro { padding: 40px 20px; text-align: center; }
.intro-logo {
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 4px;
}
.intro-logo img { height: 70px; object-fit: contain; }
.intro-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 40px 44px;
  max-width: 560px; width: 100%;
  box-shadow: var(--shadow-md);
  animation: slideUp 0.55s cubic-bezier(0.22,1,0.36,1);
}
@keyframes slideUp { from{opacity:0;transform:translateY(36px)} to{opacity:1;transform:translateY(0)} }
.intro-mascot {
  width: 180px; margin: 0 auto 16px;
  display: block; animation: floatIn 0.7s cubic-bezier(0.22,1,0.36,1);
  filter: drop-shadow(0 8px 16px rgba(232,100,12,0.20));
}
@keyframes floatIn { from{opacity:0;transform:translateY(20px) scale(0.9)} to{opacity:1;transform:translateY(0) scale(1)} }
.intro-title {
  font-size: 22px; font-weight: 800; color: var(--brown); margin-bottom: 6px;
}
.intro-subtitle { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; line-height: 1.6; }
.badge-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 24px; }
.badge {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 100px; padding: 5px 14px; font-size: 12px;
  color: var(--text-muted); display: flex; align-items: center; gap: 5px;
}
.badge span { color: var(--primary); font-weight: 700; }
.divider {
  height: 1px; background: var(--border); margin: 20px 0;
}

/* ===== FORM ===== */
.form-group { text-align: left; margin-bottom: 16px; }
label {
  display: block; font-size: 12px; font-weight: 700; color: var(--text-muted);
  margin-bottom: 6px; letter-spacing: 0.5px; text-transform: uppercase;
}
input, select {
  width: 100%; background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px; font-size: 15px; color: var(--text);
  font-family: 'Noto Sans Thai', sans-serif; transition: border-color 0.2s, box-shadow 0.2s;
  outline: none; -webkit-appearance: none;
}
input:focus, select:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow);
}
input::placeholder { color: var(--text-dim); }
select option { background: white; color: var(--text); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 28px; border-radius: var(--radius-sm); font-size: 15px; font-weight: 700;
  font-family: 'Noto Sans Thai', sans-serif; cursor: pointer; border: none; transition: all 0.2s;
}
.btn-primary {
  background: linear-gradient(135deg, #E8640C, #C4520A); color: white; width: 100%;
  box-shadow: var(--shadow-orange);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(232,100,12,0.35); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
  background: var(--bg2); border: 1.5px solid var(--border); color: var(--text-muted); flex: 1;
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-green { background: linear-gradient(135deg, #2E7D32, #1B5E20); color: white; flex: 1; box-shadow: 0 4px 16px rgba(46,125,50,0.3); }
.btn-green:hover { box-shadow: 0 6px 24px rgba(46,125,50,0.4); transform: translateY(-1px); }
.btn-excel {
  background: linear-gradient(135deg, #1D6F42, #145A32); color: white;
  box-shadow: 0 4px 16px rgba(29,111,66,0.3); width: 100%; margin-top: 12px;
}
.btn-excel:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(29,111,66,0.4); }

/* ===== EXAM HEADER ===== */
#page-exam { align-items: stretch; justify-content: flex-start; }
.exam-header {
  background: var(--surface); border-bottom: 1.5px solid var(--border);
  padding: 12px 28px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 12px rgba(61,35,20,0.07);
}
.exam-header-left { display: flex; align-items: center; gap: 14px; }
.exam-logo-sm img { height: 38px; object-fit: contain; }
.exam-info-chip {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 100px; padding: 5px 13px; font-size: 12px; color: var(--text-muted);
  font-weight: 600;
}
.exam-timer {
  display: flex; align-items: center; gap: 7px;
  background: var(--brown); border-radius: 100px; padding: 8px 16px;
  font-size: 15px; font-weight: 700; color: white; font-variant-numeric: tabular-nums;
}
.exam-timer.warning { background: #C62828; }
.timer-icon { animation: pulse 1s ease infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }
.progress-bar-wrap { background: var(--bg3); height: 5px; width: 100%; }
.progress-bar {
  height: 5px; background: linear-gradient(90deg, var(--primary), var(--accent2));
  transition: width 0.4s cubic-bezier(0.22,1,0.36,1);
  box-shadow: 0 0 8px rgba(232,100,12,0.5);
}

/* ===== EXAM BODY ===== */
.exam-body { flex:1; max-width:780px; width:100%; margin:0 auto; padding:28px 20px 80px; }
.q-nav {
  display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 24px;
  padding: 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.q-nav-title {
  width: 100%; font-size: 11px; font-weight: 700; color: var(--text-dim);
  letter-spacing: 1px; text-transform: uppercase; margin-bottom: 4px;
}
.q-dot {
  width: 35px; height: 35px; border-radius: 8px; border: 1.5px solid var(--border);
  background: var(--bg); color: var(--text-dim); font-size: 12px; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.18s;
}
.q-dot:hover { border-color: var(--primary); color: var(--primary); background: var(--bg2); }
.q-dot.answered { background: var(--primary); border-color: var(--primary); color: white; }
.q-dot.current { border-color: var(--brown); color: var(--brown); box-shadow: 0 0 0 3px rgba(61,35,20,0.12); }
.q-dot.answered.current { background: var(--primary); border-color: var(--brown); color: white; }

/* ===== QUESTION CARD ===== */
.question-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px; margin-bottom: 20px; animation: fadeIn 0.28s ease; box-shadow: var(--shadow);
}
@keyframes fadeIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }
.question-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.q-number {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white; min-width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; flex-shrink: 0; padding: 0 8px;
}
.q-type-badge {
  background: var(--bg3); border: 1px solid var(--border); border-radius: 100px;
  padding: 4px 12px; font-size: 11px; color: var(--text-muted); font-weight: 700;
}
.q-score-badge {
  margin-left: auto; background: rgba(232,100,12,0.08); border: 1px solid rgba(232,100,12,0.25);
  border-radius: 100px; padding: 4px 12px; font-size: 12px; color: var(--primary); font-weight: 700;
}
.question-text { font-size: 16px; font-weight: 600; color: var(--text); line-height: 1.75; margin-bottom: 20px; }
.question-text strong { color: var(--primary-dark); }

/* ===== CHOICES ===== */
.choices { display: flex; flex-direction: column; gap: 9px; }
.choice-item {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px;
  background: var(--bg); border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; transition: all 0.18s; user-select: none;
}
.choice-item:hover { border-color: var(--primary); background: var(--bg2); }
.choice-item.selected { border-color: var(--primary); background: rgba(232,100,12,0.07); box-shadow: 0 0 0 3px var(--primary-glow); }
.choice-key {
  width: 28px; height: 28px; border-radius: 7px; background: var(--bg3);
  border: 1.5px solid var(--border); display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: var(--text-muted); flex-shrink: 0; transition: all 0.18s;
}
.choice-item.selected .choice-key { background: var(--primary); border-color: var(--primary); color: white; }
.choice-text { font-size: 15px; color: var(--text); line-height: 1.6; flex: 1; }

/* ===== MATCHING ===== */
.matching-instructions {
  background: rgba(232,100,12,0.06); border: 1px solid rgba(232,100,12,0.2);
  border-radius: var(--radius-sm); padding: 14px 18px; margin-bottom: 16px;
}
.mi-title { font-size: 13px; font-weight: 700; color: var(--primary); margin-bottom: 10px; }
.matching-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); gap: 7px; }
.matching-option {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 11px; font-size: 13px; color: var(--text-muted);
}
.matching-option span { font-weight: 800; color: var(--primary); margin-right: 5px; }
.matching-questions { display: flex; flex-direction: column; gap: 8px; }
.matching-q-row {
  display: flex; align-items: center; gap: 10px; background: var(--bg);
  border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px;
  transition: border-color 0.2s;
}
.matching-q-row:focus-within { border-color: var(--primary); }
.matching-q-text { font-size: 14px; color: var(--text); flex: 1; font-weight: 500; }
.matching-select {
  width: 155px; flex-shrink: 0; background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 8px; padding: 7px 9px; font-size: 13px; color: var(--text);
  font-family: 'Noto Sans Thai', sans-serif; cursor: pointer; outline: none; -webkit-appearance: none;
}
.matching-select:focus { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-glow); }
.matching-select.has-value { border-color: var(--primary); color: var(--primary-dark); font-weight: 600; }

/* ===== ESSAY (unused now but keep for safety) ===== */
.essay-subfield { margin-bottom: 15px; }
.essay-subfield-label { font-size: 13px; font-weight: 700; color: var(--primary); margin-bottom: 7px; }
.essay-textarea {
  width: 100%; background: var(--bg); border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: 13px; font-size: 15px; color: var(--text); font-family: 'Noto Sans Thai', sans-serif;
  resize: vertical; min-height: 110px; transition: border-color 0.2s, box-shadow 0.2s; outline: none; line-height: 1.7;
}
.essay-textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }

/* ===== NAV BUTTONS ===== */
.exam-nav { display: flex; gap: 10px; }
.btn-nav {
  flex: 1; padding: 13px 18px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 700;
  font-family: 'Noto Sans Thai', sans-serif; cursor: pointer; border: none; transition: all 0.2s;
  display: flex; align-items: center; justify-content: center; gap: 7px;
}
.btn-prev { background: var(--bg2); border: 1.5px solid var(--border); color: var(--text-muted); }
.btn-prev:hover { border-color: var(--primary); color: var(--primary); }
.btn-next {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white; box-shadow: var(--shadow-orange);
}
.btn-next:hover { box-shadow: 0 6px 24px rgba(232,100,12,0.45); transform: translateY(-1px); }
.btn-submit-nav { background: linear-gradient(135deg, #2E7D32, #1B5E20); color: white; box-shadow: 0 4px 16px rgba(46,125,50,0.3); }
.btn-submit-nav:hover { box-shadow: 0 6px 24px rgba(46,125,50,0.4); transform: translateY(-1px); }

/* ===== RESULT ===== */
#page-result { padding: 40px 20px; }
.result-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 24px;
  padding: 40px 36px; max-width: 680px; width: 100%;
  box-shadow: var(--shadow-md); animation: slideUp 0.55s cubic-bezier(0.22,1,0.36,1); text-align: center;
}
.result-logo { margin-bottom: 16px; }
.result-logo img { height: 50px; object-fit: contain; }
.result-icon { font-size: 58px; margin-bottom: 10px; display: block; animation: bounceIn 0.7s cubic-bezier(0.22,1,0.36,1); }
@keyframes bounceIn { 0%{transform:scale(0);opacity:0} 60%{transform:scale(1.18)} 100%{transform:scale(1);opacity:1} }
.score-circle {
  width: 150px; height: 150px; border-radius: 50%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; margin: 0 auto 20px; position: relative;
  background: conic-gradient(var(--primary) 0%, #F0E8E2 0%);
  box-shadow: 0 0 0 8px #FFF3EA, 0 0 0 11px var(--border), 0 4px 24px var(--primary-glow);
}
.score-circle::before { content:''; position:absolute; inset:12px; border-radius:50%; background: var(--surface); }
.score-number { position:relative; font-size:34px; font-weight:800; color:var(--brown); }
.score-total { position:relative; font-size:12px; color:var(--text-muted); }
.result-grade { font-size: 26px; font-weight: 800; margin-bottom: 6px; color: var(--brown); }
.result-msg { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; }
.employee-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 18px; margin-bottom: 20px; display: flex; align-items: center; gap: 12px; text-align: left;
}
.employee-avatar {
  width: 42px; height: 42px; border-radius: 11px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0;
}
.employee-name { font-size: 15px; font-weight: 700; color: var(--brown); }
.employee-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.result-info-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 24px; }
.result-info-item { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 10px; }
.rval { font-size: 22px; font-weight: 800; }
.rval.green { color: var(--green); }
.rval.red { color: var(--red); }
.rval.orange { color: var(--primary); }
.rlabel { font-size: 11px; color: var(--text-muted); margin-top: 3px; font-weight: 600; }
.result-details { text-align: left; border-top: 1px solid var(--border); padding-top: 20px; margin-bottom: 20px; }
.result-details-title { font-size: 13px; font-weight: 700; color: var(--text-muted); letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 10px; }
.result-q-row { display: flex; align-items: center; gap: 9px; padding: 7px 0; border-bottom: 1px solid rgba(61,35,20,0.05); font-size: 13px; }
.result-q-num { width: 26px; height: 26px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.result-q-num.correct { background: rgba(46,125,50,0.12); color: var(--green); }
.result-q-num.wrong { background: rgba(198,40,40,0.10); color: var(--red); }
.result-q-num.essay { background: rgba(232,100,12,0.12); color: var(--primary); }
.result-q-text { flex: 1; color: var(--text-muted); line-height: 1.4; }
.result-q-ans { font-size: 12px; color: var(--text-dim); max-width: 200px; text-align: right; }
.correct-ans { color: var(--green); font-weight: 600; }
.wrong-ans { color: var(--red); font-weight: 600; }
.result-actions { display: flex; flex-direction: column; gap: 10px; }

/* ===== MODAL ===== */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(61,35,20,0.45);
  backdrop-filter: blur(6px); z-index: 1000; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: 36px; max-width: 400px; width: 100%; box-shadow: var(--shadow-md);
  animation: slideUp 0.28s cubic-bezier(0.22,1,0.36,1); text-align: center;
}
.modal-icon { font-size: 44px; margin-bottom: 12px; display: block; }
.modal-title { font-size: 19px; font-weight: 800; margin-bottom: 7px; color: var(--brown); }
.modal-msg { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; line-height: 1.6; }
.modal-btns { display: flex; gap: 10px; }

/* ===== TOAST ===== */
.toast {
  position: fixed; top: 18px; right: 18px; background: var(--brown); border-radius: var(--radius-sm);
  padding: 13px 18px; font-size: 14px; color: white; box-shadow: var(--shadow-md);
  z-index: 9999; transform: translateX(130%); transition: transform 0.3s cubic-bezier(0.22,1,0.36,1);
  display: flex; align-items: center; gap: 9px; max-width: 300px;
}
.toast.show { transform: translateX(0); }

/* ===== SCREENSHOT NOTICE ===== */
.screenshot-notice {
  position: fixed; inset: 0; background: rgba(255,249,245,0.97); z-index: 9999;
  display: none; align-items: center; justify-content: center; flex-direction: column; gap: 14px; text-align: center; padding: 40px;
}
.screenshot-notice.show { display: flex; }
.sn-icon { font-size: 60px; }
.sn-text { font-size: 18px; font-weight: 700; color: var(--red); }
.sn-sub { font-size: 14px; color: var(--text-muted); }

/* ===== PASS/FAIL BANNER ===== */
.pass-banner {
  border-radius: var(--radius-sm); padding: 14px 18px; margin-bottom: 20px;
  display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 15px;
}
.pass-banner.pass { background: rgba(46,125,50,0.08); border: 1.5px solid rgba(46,125,50,0.3); color: var(--green); }
.pass-banner.fail { background: rgba(198,40,40,0.07); border: 1.5px solid rgba(198,40,40,0.25); color: var(--red); }

/* ===== RESPONSIVE ===== */
@media (max-width:600px) {
  .intro-card { padding: 28px 20px; }
  .exam-header { padding: 10px 14px; flex-wrap: wrap; gap: 7px; }
  .exam-body { padding: 18px 14px 60px; }
  .question-card { padding: 20px 15px; }
  .result-card { padding: 28px 18px; }
  .score-circle { width: 120px; height: 120px; }
  .score-number { font-size: 26px; }
}

/* ===== LOGIN PAGE ===== */
.login-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 24px;
  padding: 44px 40px; max-width: 520px; width: 100%;
  box-shadow: var(--shadow-md); animation: slideUp 0.55s cubic-bezier(0.22,1,0.36,1); text-align: center;
}
.login-logo { margin-bottom: 12px; }
.login-logo img { height: 62px; object-fit: contain; }
.login-title { font-size: 20px; font-weight: 800; color: var(--brown); margin-bottom: 6px; }
.login-subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 28px; }
.role-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 20px; }
.role-card {
  background: var(--bg); border: 2px solid var(--border); border-radius: 16px;
  padding: 24px 16px; cursor: pointer; transition: all 0.22s; text-align: center;
  font-family: 'Noto Sans Thai', sans-serif;
}
.role-card:hover { border-color: var(--primary); background: var(--bg2); transform: translateY(-2px); box-shadow: var(--shadow-orange); }
.role-card.selected { border-color: var(--primary); background: rgba(232,100,12,0.07); box-shadow: 0 0 0 3px var(--primary-glow); }
.role-icon { font-size: 36px; margin-bottom: 8px; }
.role-name { font-size: 16px; font-weight: 800; color: var(--brown); margin-bottom: 5px; }
.role-desc { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.admin-pass-box {
  background: rgba(232,100,12,0.05); border: 1px solid rgba(232,100,12,0.2);
  border-radius: var(--radius-sm); padding: 18px; margin-top: 4px;
  animation: fadeIn 0.25s ease;
  display: none;
}
.admin-pass-box.show { display: block; }
.pass-toggle {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; font-size: 18px; padding: 0; line-height: 1;
}
.btn-back-login {
  display: block; width: 100%; margin-top: 12px; background: none; border: none;
  color: var(--text-dim); font-size: 13px; cursor: pointer; font-family: 'Noto Sans Thai', sans-serif;
  padding: 6px; transition: color 0.2s;
}
.btn-back-login:hover { color: var(--primary); }

/* ===== ADMIN PAGE ===== */
#page-admin { align-items: stretch; justify-content: flex-start; background: var(--bg); }
.admin-header {
  background: var(--surface); border-bottom: 1.5px solid var(--border);
  padding: 14px 32px; display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 2px 12px rgba(61,35,20,0.07); position: sticky; top: 0; z-index: 100;
}
.admin-header-left { display: flex; align-items: center; gap: 16px; }
.admin-logo { height: 40px; object-fit: contain; }
.admin-header-title { font-size: 16px; font-weight: 800; color: var(--brown); }
.admin-header-sub { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.btn-logout {
  background: var(--bg2); border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 18px; font-size: 13px; font-weight: 700; color: var(--text-muted);
  cursor: pointer; font-family: 'Noto Sans Thai', sans-serif; transition: all 0.2s;
}
.btn-logout:hover { border-color: var(--red); color: var(--red); }
.admin-body { padding: 28px 32px; flex: 1; }
.admin-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow);
}
.stat-val { font-size: 28px; font-weight: 800; margin-bottom: 4px; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.admin-actions {
  display: flex; gap: 12px; margin-bottom: 20px; align-items: center; flex-wrap: wrap;
}
.admin-actions input {
  flex: 1; min-width: 220px; background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 16px; font-size: 14px; color: var(--text);
  font-family: 'Noto Sans Thai', sans-serif; outline: none; transition: border-color 0.2s;
}
.admin-actions input:focus { border-color: var(--primary); }
.btn-danger {
  background: linear-gradient(135deg, #C62828, #B71C1C); color: white;
  box-shadow: 0 4px 16px rgba(198,40,40,0.3); padding: 11px 20px;
  border-radius: var(--radius-sm); font-size: 14px; font-weight: 700;
  font-family: 'Noto Sans Thai', sans-serif; cursor: pointer; border: none; transition: all 0.2s;
}
.btn-danger:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(198,40,40,0.4); }
.btn-excel { padding: 11px 20px; font-size: 14px; }
.admin-table-wrap {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: auto;
}
.admin-table { width: 100%; border-collapse: collapse; min-width: 900px; }
.admin-table thead th {
  background: var(--bg2); color: var(--brown); font-size: 12px; font-weight: 700;
  padding: 12px 14px; text-align: left; border-bottom: 1.5px solid var(--border);
  white-space: nowrap; text-transform: uppercase; letter-spacing: 0.4px;
}
.admin-table tbody tr { border-bottom: 1px solid rgba(61,35,20,0.05); transition: background 0.15s; }
.admin-table tbody tr:hover { background: var(--bg); }
.admin-table tbody td { padding: 11px 14px; font-size: 13px; color: var(--text); vertical-align: middle; }
.admin-table tbody td.date-cell { color: var(--text-muted); font-size: 12px; }
.pass-chip {
  display: inline-flex; align-items: center; gap: 5px; border-radius: 100px;
  padding: 3px 10px; font-size: 12px; font-weight: 700; white-space: nowrap;
}
.pass-chip.pass { background: rgba(46,125,50,0.12); color: var(--green); }
.pass-chip.fail { background: rgba(198,40,40,0.10); color: var(--red); }
.score-cell { font-weight: 800; font-size: 15px; }
.score-cell.high { color: var(--green); }
.score-cell.mid { color: var(--primary); }
.score-cell.low { color: var(--red); }
.admin-empty { padding: 64px 24px; text-align: center; }
@media (max-width: 768px) {
  .admin-stats { grid-template-columns: repeat(2, 1fr); }
  .admin-body { padding: 18px 14px; }
  .admin-header { padding: 10px 14px; }
  .role-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .login-card { padding: 28px 20px; }
}
@media (max-width: 480px) {
  .role-grid { grid-template-columns: 1fr; }
  .admin-stats { grid-template-columns: 1fr 1fr; }
}

/* ===== WAITING PAGE ===== */
.waiting-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 24px;
  padding: 52px 40px; max-width: 460px; width: 100%; text-align: center;
  box-shadow: var(--shadow-md); animation: slideUp 0.55s cubic-bezier(0.22,1,0.36,1);
}
.waiting-logo { margin-bottom: 20px; }
.waiting-logo img { height: 52px; object-fit: contain; }
.waiting-spinner {
  position: relative; width: 90px; height: 90px;
  margin: 0 auto 24px; display: flex; align-items: center; justify-content: center;
}
.spinner-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 4px solid var(--bg2); border-top-color: var(--primary);
  animation: spin 1s linear infinite;
}
.spinner-icon { font-size: 36px; z-index: 1; }
@keyframes spin { to { transform: rotate(360deg); } }
.waiting-title { font-size: 20px; font-weight: 800; color: var(--brown); margin-bottom: 10px; }
.waiting-sub { font-size: 14px; color: var(--text-muted); margin-bottom: 16px; line-height: 1.6; }
.waiting-info {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 18px; margin-bottom: 16px; font-size: 13px; text-align: left;
}
.waiting-countdown {
  font-size: 28px; font-weight: 800; color: var(--primary);
  margin-bottom: 12px; letter-spacing: 2px;
}
.waiting-dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 20px; }
.waiting-dots span {
  width: 8px; height: 8px; border-radius: 50%; background: var(--primary);
  animation: dotPulse 1.4s ease-in-out infinite;
}
.waiting-dots span:nth-child(2) { animation-delay: 0.2s; }
.waiting-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotPulse { 0%,80%,100%{opacity:0.2;transform:scale(0.8)} 40%{opacity:1;transform:scale(1)} }
.waiting-approved .spinner-ring { border-top-color: var(--green); animation: none; border-color: var(--green); }
.waiting-rejected .spinner-ring { border-top-color: var(--red); animation: none; border-color: var(--red); }

/* ===== ADMIN TABS ===== */
.admin-tabs {
  display: flex; gap: 0; background: var(--surface);
  border-bottom: 2px solid var(--border); padding: 0 32px;
}
.admin-tab {
  padding: 14px 24px; font-size: 14px; font-weight: 700;
  color: var(--text-muted); background: none; border: none;
  border-bottom: 3px solid transparent; margin-bottom: -2px;
  cursor: pointer; font-family: 'Noto Sans Thai', sans-serif;
  transition: all 0.2s; display: flex; align-items: center; gap: 8px;
}
.admin-tab:hover { color: var(--primary); }
.admin-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-badge {
  background: var(--primary); color: white;
  border-radius: 100px; padding: 2px 8px; font-size: 11px; font-weight: 800;
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.7} }

/* ===== PENDING REQUESTS ===== */
.pending-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 8px; }
.pending-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 18px 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  box-shadow: var(--shadow); transition: box-shadow 0.2s;
}
.pending-card:hover { box-shadow: var(--shadow-md); }
.pending-info { flex: 1; }
.pending-name { font-size: 16px; font-weight: 800; color: var(--brown); margin-bottom: 4px; }
.pending-meta { font-size: 13px; color: var(--text-muted); }
.pending-time { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.pending-btns { display: flex; gap: 8px; flex-shrink: 0; }
.btn-approve {
  background: linear-gradient(135deg, #2E7D32, #388E3C); color: white;
  border: none; border-radius: var(--radius-sm); padding: 9px 18px;
  font-size: 13px; font-weight: 700; cursor: pointer;
  font-family: 'Noto Sans Thai', sans-serif; transition: all 0.2s; white-space: nowrap;
}
.btn-approve:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(46,125,50,0.35); }
.btn-reject {
  background: linear-gradient(135deg, #C62828, #B71C1C); color: white;
  border: none; border-radius: var(--radius-sm); padding: 9px 18px;
  font-size: 13px; font-weight: 700; cursor: pointer;
  font-family: 'Noto Sans Thai', sans-serif; transition: all 0.2s; white-space: nowrap;
}
.btn-reject:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(198,40,40,0.35); }
.pending-stats-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-bottom: 20px; }

@media (max-width: 640px) {
  .pending-card { flex-direction: column; align-items: flex-start; }
  .pending-btns { width: 100%; }
  .btn-approve, .btn-reject { flex: 1; text-align: center; }
  .admin-tabs { padding: 0 14px; }
  .admin-tab { padding: 12px 14px; font-size: 13px; }
  .waiting-card { padding: 36px 20px; }
}