:root {
  --primary: #7c3aed;
  --primary-dark: #6025c9;
  --bg: #faf9fc;
  --card: #ffffff;
  --text: #1f1b2e;
  --muted: #6b6478;
  --border: #e6e1ee;
  --success: #16a34a;
  --danger: #dc2626;
  --radius: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: 960px; margin: 0 auto; padding: 0 20px; }

header.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 18px 0;
  margin-bottom: 32px;
}
header.site-header .container { display: flex; align-items: center; justify-content: space-between; }
header.site-header h1 { font-size: 1.25rem; margin: 0; }
header.site-header .tagline { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }

.hero { padding: 8px 0 28px; }
.hero h2 { font-size: 1.6rem; margin-bottom: 6px; }
.hero p { color: var(--muted); }

.dept-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.dept-filter a {
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border);
  color: var(--text); background: var(--card); font-size: 0.9rem;
}
.dept-filter a.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.dept-filter a:hover { text-decoration: none; border-color: var(--primary); }

.job-list { display: grid; gap: 14px; margin-bottom: 40px; }
.job-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px;
}
.job-card h3 { margin: 0 0 4px; font-size: 1.05rem; }
.job-card .meta { color: var(--muted); font-size: 0.85rem; margin-bottom: 10px; }
.job-card .btn-view { display: inline-block; margin-top: 6px; }

.empty-state { color: var(--muted); padding: 40px 0; text-align: center; }

.job-detail { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; margin-bottom: 24px; }
.job-detail h2 { margin-top: 0; }
.job-detail .jd-content { white-space: pre-wrap; margin: 18px 0; }

form .field { margin-bottom: 16px; }
form label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.92rem; }
form input[type=text], form input[type=email], form input[type=tel], form input[type=password],
form textarea, form select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 0.95rem; font-family: inherit; background: #fff; color: var(--text);
}
form textarea { min-height: 110px; resize: vertical; }
form .checkbox-field { display: flex; align-items: flex-start; gap: 8px; }
form .checkbox-field input { margin-top: 4px; }
form .checkbox-field label { font-weight: 400; font-size: 0.88rem; }
form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.btn {
  display: inline-block; background: var(--primary); color: #fff; border: none;
  padding: 11px 22px; border-radius: 8px; font-size: 0.95rem; cursor: pointer; font-weight: 600;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn.secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: var(--danger); }
.btn.small { padding: 6px 12px; font-size: 0.82rem; }

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; font-size: 0.9rem; }
.alert.error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.alert.success { background: #f0fdf4; color: var(--success); border: 1px solid #bbf7d0; }

.success-box { text-align: center; padding: 60px 20px; }
.success-box .icon { font-size: 3rem; margin-bottom: 12px; }

footer.site-footer { color: var(--muted); font-size: 0.8rem; text-align: center; padding: 30px 0; border-top: 1px solid var(--border); margin-top: 40px; }
footer.site-footer .footer-clinic-name { font-weight: 600; color: var(--text); margin-bottom: 6px; }
footer.site-footer .footer-contact { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; margin-bottom: 6px; }
footer.site-footer .footer-description { max-width: 560px; margin: 0 auto 10px; line-height: 1.5; }
footer.site-footer .footer-copyright { font-size: 0.75rem; }

/* ---- Admin ---- */
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 220px; background: #1f1b2e; color: #fff; flex-shrink: 0; padding: 22px 0;
  display: flex; flex-direction: column;
}
.admin-sidebar .brand { padding: 0 20px 20px; font-weight: 700; border-bottom: 1px solid #35304a; margin-bottom: 12px; }
.admin-sidebar nav { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.admin-sidebar nav a {
  display: block; padding: 10px 20px; color: #cfc9dd; font-size: 0.9rem;
}
.admin-sidebar nav a:hover, .admin-sidebar nav a.active { background: #2c2640; color: #fff; text-decoration: none; }
.admin-sidebar .logout-form { margin-top: auto; padding: 20px; display: flex; justify-content: center; }
.admin-sidebar .logout-form .btn { width: auto; min-width: 140px; }
.admin-main { flex: 1; padding: 16px 36px 30px; max-width: 1320px; }
.admin-main-wide { max-width: none; }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.back-link { margin: 0 0 10px; font-size: 0.85rem; }
.admin-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 20px; }
table.admin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.admin-table th, table.admin-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
table.admin-table th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.badge.RECEIVED { background: #e0e7ff; color: #3730a3; }
.badge.REVIEWING { background: #fef9c3; color: #854d0e; }
.badge.INTERVIEW_SCHEDULED { background: #dbeafe; color: #1e40af; }
.badge.REJECTED { background: #fee2e2; color: #991b1b; }
.badge.HIRED { background: #dcfce7; color: #166534; }
.status-filters { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.status-filters a { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border); font-size: 0.82rem; color: var(--text); }
.status-filters a.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-box { width: 340px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 30px; }
.login-box h1 { font-size: 1.1rem; margin-top: 0; }
.helper-text { color: var(--muted); font-size: 0.8rem; margin-top: 4px; }
.reset-link { display: block; word-break: break-all; background: #f8fafc; border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; margin-top: 8px; font-family: monospace; font-size: 0.82rem; }
.overview-stats {
  display: flex; flex-wrap: nowrap; gap: 10px; margin-bottom: 18px;
  overflow-x: auto; padding-bottom: 6px; -webkit-overflow-scrolling: touch;
}
.overview-stats .stat-item {
  flex: 0 0 auto; min-width: 100px; background: #f8fafc; border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 16px; text-align: center;
}
.overview-stats .stat-item.stat-total { background: #eef2ff; border-color: #c7d2fe; }
.overview-stats .stat-num { font-size: 1.35rem; font-weight: 700; color: var(--text); line-height: 1.2; white-space: nowrap; }
.overview-stats .stat-label { font-size: 0.72rem; color: var(--muted); margin-top: 2px; white-space: nowrap; }
@media (min-width: 640px) {
  .overview-stats .stat-item { flex: 1 1 0; min-width: 0; }
}
.date-filter-form { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.date-filter-form .field-inline { display: flex; flex-direction: column; gap: 4px; }
.date-filter-form .field-inline label { font-size: 0.78rem; color: var(--muted); }
.date-filter-form .field-inline input { padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.85rem; }

/* Lịch hẹn phỏng vấn/nhận việc ở trang chi tiết ứng viên: xếp dọc trên màn hình hẹp
   (điện thoại), chuyển sang 2 cột ngang khi đủ rộng (máy tính). */
.schedule-row { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.schedule-row .field-col { flex: 1; }
@media (min-width: 640px) {
  .schedule-row { flex-direction: row; }
}
/* Gộp khối "phỏng vấn" + "nhận việc" thành 1 hàng ngang khi màn hình đủ rộng (máy tính lớn)
   để đỡ tốn chiều cao — mục tiêu: các thao tác trên trang chi tiết ứng viên gọn trong 1
   màn hình, không phải cuộn xuống. */
.schedule-group { display: flex; flex-direction: column; }
@media (min-width: 900px) {
  .schedule-group { flex-direction: row; gap: 20px; }
  .schedule-group .schedule-row { flex: 1; }
}

/* Trang chi tiết ứng viên: 3 cột trên màn hình đủ rộng — trái: thông tin ứng viên (ngắn,
   chỉ đọc); giữa: khu vực thao tác (xem mẫu + đổi trạng thái + gửi email); phải: ghi chú
   nội bộ. Xếp dọc như bình thường trên màn hình hẹp/điện thoại/laptop nhỏ. */
.cd-grid { display: flex; flex-direction: column; gap: 20px; }
@media (min-width: 1080px) {
  .cd-grid { flex-direction: row; align-items: flex-start; }
  .cd-grid .cd-col-info { flex: 0 0 300px; }
  .cd-grid .cd-col-actions { flex: 1 1 auto; min-width: 360px; }
  .cd-grid .cd-col-note { flex: 0 0 260px; }
}
.cd-divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* Dropdown + nút bấm nằm cùng 1 hàng (VD "Chọn trạng thái" + "Tải mẫu"). Khai báo
   min-width:0 trên phần tử co giãn để tránh lỗi flex item không chịu co lại theo nội dung
   bên trong (select) rồi bị đẩy xuống dòng dưới trên 1 số trình duyệt/độ rộng. */
.field-inline-btn { display: flex; flex-wrap: nowrap; gap: 10px; align-items: end; margin-bottom: 8px; }
.field-inline-btn > div { flex: 1 1 auto; min-width: 0; margin-bottom: 0; }
.field-inline-btn > button { flex: 0 0 auto; }

/* Cột phải (khu vực thao tác) giãn dòng nhỏ lại + bớt khoảng cách giữa các trường, cho gọn
   hơn vì đây là nơi có nhiều field nhất trên trang chi tiết ứng viên. */
.cd-col-actions { line-height: 1.3; }
.cd-col-actions .field { margin-bottom: 12px; }
.cd-col-actions form label { margin-bottom: 4px; }
.cd-col-actions .helper-text { margin-top: 4px; }
