:root {
    --primary-red: #a81c1c;
    --primary-gold: #f4b41a;
    --bg-color: #f0f2f5;
    --text-color: #333;
    --border-color: #ddd;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
body { background-color: var(--bg-color); color: var(--text-color); }

/* --- THANH TOPBAR --- */
.top-navbar { background-color: var(--primary-red); padding: 15px 30px; display: flex; justify-content: space-between; align-items: center; color: white; box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
.top-navbar .logo { font-size: 20px; font-weight: bold; color: var(--primary-gold); }
.user-info { display: flex; align-items: center; gap: 15px; font-weight: 500; }
.btn-logout { background: transparent; color: white; border: 1px solid white; padding: 5px 15px; border-radius: 5px; cursor: pointer; transition: 0.3s; }
.btn-logout:hover { background: white; color: var(--primary-red); }

.container { max-width: 1200px; margin: 30px auto; padding: 20px; }

/* Ẩn/Hiện Section */
.app-section { display: none; animation: fadeIn 0.4s ease; }
.app-section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* --- FORM ĐĂNG NHẬP --- */
.login-box { background: white; max-width: 400px; margin: 80px auto; padding: 40px 30px; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); text-align: center; }
.login-box h2 { color: var(--primary-red); margin-bottom: 5px; }
.form-group { text-align: left; margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: bold; font-size: 14px; }
.form-group input { width: 100%; padding: 10px; border: 1px solid var(--border-color); border-radius: 5px; }
.btn-primary { background-color: var(--primary-gold); color: #000; border: none; padding: 10px 20px; font-size: 15px; font-weight: bold; border-radius: 5px; cursor: pointer; transition: 0.3s; }
.btn-primary:hover { background-color: #dca012; }
.error-msg { color: red; font-size: 13px; margin-bottom: 10px; min-height: 20px;}

/* --- MAIN MENU CHÍNH --- */
.menu-title { text-align: center; margin-bottom: 30px; color: var(--primary-red); font-size: 24px; }
.main-menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 25px; max-width: 1000px; margin: 0 auto; }
.menu-card { background: white; padding: 30px 20px; border-radius: 12px; text-align: center; cursor: pointer; transition: all 0.3s ease; box-shadow: 0 4px 6px rgba(0,0,0,0.05); border-bottom: 4px solid #eee; }
.menu-card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.1); border-bottom-color: var(--primary-gold); }
.menu-card .icon { font-size: 45px; margin-bottom: 15px; display: block; }
.menu-card h3 { font-size: 16px; color: #333; margin: 0; }

/* --- HỒ SƠ HỌC VIÊN (DASHBOARD) --- */
.action-header { display: flex; align-items: center; gap: 20px; margin-bottom: 20px; }
.btn-back { background: #e0e0e0; color: #333; border: none; padding: 10px 15px; border-radius: 5px; font-weight: bold; cursor: pointer; transition: 0.3s; }
.btn-back:hover { background: #ccc; }
.dashboard-header { display: flex; justify-content: space-between; align-items: center; flex: 1; }
.dashboard-header h2 { color: var(--primary-red); margin: 0; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 30px; }
.stat-card { background: white; padding: 20px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); text-align: center; border-bottom: 3px solid var(--border-color); transition: 0.3s;}
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 5px 15px rgba(0,0,0,0.1); border-bottom: 3px solid var(--primary-gold); }
.stat-card p { font-size: 12px; color: #777; font-weight: bold; margin-bottom: 8px;}
.stat-card h3 { font-size: 28px; }
.text-green { color: #2ecc71; } .text-orange { color: #e67e22; } .text-red { color: var(--primary-red); }

.table-container { background: white; padding: 20px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; margin-top: 15px; min-width: 800px; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid var(--border-color); font-size: 14px; }
th { background-color: #f8f9fa; color: #555; text-transform: uppercase; font-size: 13px;}

/* Huy hiệu (Badge) CSS */
.badge { padding: 5px 10px; border-radius: 12px; font-size: 12px; font-weight: bold; text-align: center; display: inline-block; }
.badge.gold { background: #fdf5e6; color: #e67e22; border: 1px solid #f4b41a; }
.badge.hoat-dong { background-color: #3498db; color: #ffffff; border: none; }
.badge.bao-luu { background-color: #f39c12; color: #ffffff; border: none; }
.badge.nghi-tap { background-color: #e74c3c; color: #ffffff; border: none; }

/* Trạng thái "Để trống" ưu tiên bôi Vàng - Đỏ cả dòng */
.row-de-trong { background-color: #fff176 !important; }
.row-de-trong td, .row-de-trong td div, .row-de-trong td strong, .row-de-trong button, .row-de-trong .badge {
    color: #d32f2f !important; border-color: #d32f2f !important; 
}
.row-de-trong .badge { background-color: transparent !important; }

.student-info-cell { display: flex; align-items: center; gap: 10px; }
.avatar-small { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 1px solid #ccc; }

/* --- MODAL THÊM/SỬA HỌC VIÊN --- */
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.6); overflow-y: auto; backdrop-filter: blur(3px); }
.modal-content { background-color: #fdfdfd; margin: 3% auto; border-radius: 10px; width: 92%; max-width: 1250px; box-shadow: 0 10px 25px rgba(0,0,0,0.3); overflow: hidden; animation: fadeIn 0.3s;}
.modal-header { background-color: var(--primary-red); color: white; padding: 15px 25px; display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { margin: 0; }
.close { color: white; font-size: 28px; cursor: pointer; transition: 0.2s; line-height: 1; }
.close:hover { color: var(--primary-gold); transform: scale(1.1); }
.modal-body { padding: 25px; background: #fafafa; }
.modal-footer { padding: 15px 25px; background: #fff; border-top: 1px solid #eee; text-align: right; }

.form-section { background: white; border: 1px solid #e0e0e0; border-radius: 8px; padding: 25px; margin-bottom: 25px; box-shadow: 0 2px 4px rgba(0,0,0,0.02); }
.section-title { color: var(--primary-red); margin-bottom: 20px; border-bottom: 2px solid #f0f0f0; padding-bottom: 8px; font-size: 16px; font-weight: bold; }
.form-group-item { display: flex; flex-direction: column; }
.form-group-item label { font-size: 13px; color: #555; margin-bottom: 6px; font-weight: bold; }
.form-group-item input, .form-group-item select { padding: 10px; border: 1px solid #ccc; border-radius: 5px; font-size: 14px; transition: border 0.3s; }
.form-group-item input:focus, .form-group-item select:focus { border-color: var(--primary-red); outline: none; }

/* Hiệu ứng khi input/select bị khóa quyền */
.form-group-item select:disabled, .form-group-item input:disabled { background-color: #f1f1f1 !important; color: #888 !important; cursor: not-allowed; border-color: #e0e0e0 !important; }

.span-2 { grid-column: span 2; } .span-3 { grid-column: span 3; }

/* Thông tin & Avatar */
.personal-info-layout { display: flex; gap: 30px; }
.avatar-upload-box { width: 140px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.avatar-preview { width: 120px; height: 160px; border: 2px dashed #bbb; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: #f9f9f9; overflow: hidden; }
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.btn-upload { background: white; border: 1px solid var(--primary-red); color: var(--primary-red); padding: 8px 10px; font-size: 13px; font-weight: bold; border-radius: 5px; cursor: pointer; width: 100%; transition: 0.3s;}
.btn-upload:hover { background: var(--primary-red); color: white; }
#avatarInput { display: none; }
.personal-info-grid { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }

/* Quét khuôn mặt */
.face-id-group { display: flex; gap: 10px; }
.btn-scan-face { background-color: #3498db; color: white; border: none; padding: 10px 15px; border-radius: 5px; cursor: pointer; font-size: 14px; font-weight: bold; transition: 0.3s; white-space: nowrap; }
.btn-scan-face:hover { background-color: #2980b9; }

/* --- THIẾT LẬP LỊCH CA TẬP --- */
.schedule-grid-container { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.schedule-day-card { border: 1px solid #e0e0e0; border-radius: 8px; background: #fff; overflow: hidden; transition: all 0.3s ease; display: flex; flex-direction: column; }
.schedule-header { background: #f8f9fa; padding: 10px; border-bottom: 1px solid #eee; text-align: center; }
.day-name { font-weight: bold; font-size: 14px; color: var(--primary-red); }

.session-block { padding: 10px; border-bottom: 1px solid #f0f0f0; transition: background 0.3s; }
.session-block:last-child { border-bottom: none; }
.session-block.active { background: #fffdf7; }

.session-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.session-title-label { font-size: 12px; font-weight: bold; color: #555; }
.session-block.active .session-title-label { color: #d35400; }

.toggle-switch { position: relative; display: inline-block; width: 30px; height: 16px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .3s; border-radius: 30px; }
.slider:before { position: absolute; content: ""; height: 12px; width: 12px; left: 2px; bottom: 2px; background-color: white; transition: .3s; border-radius: 50%; }
input:checked + .slider { background-color: var(--primary-gold); }
input:checked + .slider:before { transform: translateX(14px); }

.session-inputs { display: flex; flex-direction: column; gap: 6px; }
.session-input-item label { font-size: 10px; color: #777; font-weight: bold; display: block; margin-bottom: 2px; }
.session-inputs input { width: 100%; padding: 5px 6px; font-size: 11px; border: 1px solid #ccc; border-radius: 4px; background-color: #f4f4f4; color: #999; transition: all 0.3s; }
.session-block.active .session-inputs input { background-color: #fff; color: #333; border-color: #aaa; }
.session-block.active .session-inputs input:focus { border-color: var(--primary-red); outline: none; }

/* --- THÔNG BÁO NOTIFICATIONS --- */
.notification-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.notification { background: white; border-left: 4px solid var(--primary-gold); box-shadow: 0 4px 12px rgba(0,0,0,0.15); padding: 15px 20px; border-radius: 4px; display: flex; align-items: center; min-width: 250px; transform: translateX(120%); transition: transform 0.4s ease-out; font-weight: 500; font-size: 14px; }
.notification.show { transform: translateX(0); }
.notification.success { border-left-color: #2ecc71; }
.notification.error { border-left-color: #e74c3c; }
.notification.warning { border-left-color: #f59e0b; background: #fffbeb; max-width: min(440px, calc(100vw - 40px)); min-width: 0; }
.incident-delete-button { margin-top: 12px; background: #fee2e2; color: #a81c1c; }
.incident-delete-button:hover { background: #fecaca; }
.incident-delete-button:disabled { opacity: 0.6; cursor: default; }
#incident-menu-card.has-incidents { background: #a81c1c; border-bottom-color: #761313; color: white; }
#incident-menu-card.has-incidents h3 { color: white; }
#incident-menu-card.has-incidents:hover { background: #911818; border-bottom-color: #f4b41a; }

/* --- Responsive Layout --- */
@media (max-width: 1200px) { 
    .schedule-grid-container { grid-template-columns: repeat(4, 1fr); } 
    .main-menu-grid { grid-template-columns: repeat(2, 1fr); } 
}
@media (max-width: 768px) {
    .personal-info-layout { flex-direction: column; align-items: center; } 
    .personal-info-grid { grid-template-columns: 1fr; width: 100%; }
    .schedule-grid-container { grid-template-columns: 1fr; } 
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .main-menu-grid { grid-template-columns: 1fr; } 
    .action-header { flex-direction: column; align-items: flex-start; }
    .dashboard-header { flex-direction: column; align-items: flex-start; gap: 10px; width: 100%;} 
    .dashboard-header .btn-primary { width: 100%; }
}
.attendance-site-buttons { display:flex; flex-wrap:wrap; gap:12px; margin-top:18px; }
.attendance-site-button { padding:12px 22px; border:1px solid var(--primary-red); border-radius:8px; background:white; color:var(--primary-red); font-size:15px; font-weight:600; cursor:pointer; overflow-wrap:anywhere; max-width:100%; }
.attendance-site-button:hover { background:#fff4e1; }
.attendance-site-button[aria-pressed="true"] { background:var(--primary-red); color:white; box-shadow:0 3px 8px rgba(168,28,28,.18); }
.attendance-site-button:focus-visible { outline:3px solid var(--primary-gold); outline-offset:3px; }

.attendance-sites-title { display:flex; align-items:center; gap:12px; padding:18px 22px; margin:-5px 0 20px; border-left:5px solid var(--primary-gold); border-radius:8px; background:linear-gradient(110deg,var(--primary-red),#7b1616); color:var(--primary-gold); font-size:24px; font-weight:700; box-shadow:0 4px 12px rgba(168,28,28,.15); }
.attendance-sites-title span { font-size:28px; }
@media (max-width:768px) { .attendance-sites-title { padding:15px; font-size:20px; } }

.attendance-day-buttons { display:flex; flex-wrap:wrap; gap:10px; padding-top:18px; margin-top:18px; border-top:1px solid #eee; }
.attendance-day-button { min-width:85px; padding:10px 16px; border:1px solid #e3c578; border-radius:8px; background:#fff9e9; color:#743d09; font-size:14px; font-weight:600; cursor:pointer; }
.attendance-day-button:hover { background:#ffefbf; }
.attendance-day-button[aria-pressed="true"] { background:var(--primary-gold); color:#3b2600; border-color:var(--primary-gold); box-shadow:0 3px 8px rgba(244,180,26,.22); }
.attendance-day-button:focus-visible { outline:3px solid var(--primary-red); outline-offset:3px; }

.attendance-face-actions { display:flex; justify-content:flex-end; margin:0 0 20px; }
.attendance-face-button { display:flex; align-items:center; justify-content:center; gap:10px; padding:14px 24px; border:0; border-radius:9px; background:var(--primary-red); color:white; font-size:16px; font-weight:700; cursor:pointer; box-shadow:0 4px 12px rgba(168,28,28,.2); }
.attendance-face-button span { font-size:23px; }
.attendance-face-button:hover { background:#801515; }
.attendance-face-button:focus-visible { outline:3px solid var(--primary-gold); outline-offset:3px; }
@media (max-width:768px) { .attendance-face-button { width:100%; } }

.attendance-student-avatar { width:56px; height:64px; border-radius:8px; object-fit:cover; border:1px solid #e3d4b1; background:#fff9e9; }
.attendance-birth-date { margin-top:6px; font-size:12px; color:#777; white-space:nowrap; }
#incident-menu-card { font:inherit; color:inherit; }
#incident-menu-card[hidden] { display:none; }
.attendance-year-label { display:flex; align-items:center; gap:10px; margin-top:18px; font-weight:bold; }
.attendance-year-label input { width:100px; padding:8px; border:1px solid #e3c578; border-radius:6px; }
.monthly-attendance-table { min-width:1700px; }
.monthly-attendance-table th { text-align:center; }
.monthly-attendance-table tr > :nth-child(-n+3) { position:sticky; z-index:2; background:#fff; }
.monthly-attendance-table tr > :nth-child(1) { left:0; }
.monthly-attendance-table tr > :nth-child(2) { left:var(--attendance-photo-left, 100px); }
.monthly-attendance-table tr > :nth-child(3) { left:var(--attendance-name-left, 180px); box-shadow:3px 0 4px rgba(0,0,0,.12); }
.monthly-attendance-table tr > th:nth-child(-n+3) { z-index:3; background:#f8f9fa; }
.attendance-date-cell { text-align:center; min-width:38px; padding:8px; }
.attendance-date-cell input { width:20px; height:20px; cursor:pointer; accent-color:var(--primary-red); }
.attendance-today { background:#fff0c6; }
.monthly-attendance-table .attendance-total-cell { position:sticky; right:0; min-width:100px; text-align:center; font-weight:700; color:var(--primary-red); background:#fff3cf; border-left:2px solid var(--primary-gold); z-index:1; }
.face-camera-content { max-width:650px; }
#face-camera-video { display:block; width:100%; max-height:380px; background:#222; border-radius:8px; margin:15px 0; }
#face-camera-modal label { display:flex; flex-direction:column; gap:6px; margin-top:12px; }
#face-camera-modal select { padding:10px; }
#face-camera-status { margin:12px 0; }
.face-camera-note { color:#777; font-size:12px; margin-top:15px; }
.incident-card { display:flex; flex-wrap:wrap; gap:20px; padding:18px 0; border-bottom:1px solid #eee; }
.incident-card img { width:180px; max-width:100%; border-radius:8px; }
.attendance-month-buttons { display:grid; grid-template-columns:repeat(12,minmax(0,1fr)); gap:10px; padding-top:18px; margin-top:18px; border-top:1px solid #eee; }
.attendance-site-section { margin-bottom:28px; }
.attendance-search-toolbar { display:flex; justify-content:space-between; align-items:center; gap:20px; padding:18px; margin-bottom:14px; border:1px solid #e3d4b1; border-radius:8px; background:#fff9e9; }
.attendance-search-toolbar h3 { color:var(--primary-red); overflow-wrap:anywhere; }
.attendance-search-label { display:flex; flex-direction:column; gap:7px; width:min(100%,420px); font-weight:600; color:#743d09; }
.attendance-search-label input { width:100%; padding:11px 13px; border:1px solid #e3c578; border-radius:7px; font:inherit; background:white; }
.attendance-search-label input:focus-visible { outline:2px solid var(--primary-gold); outline-offset:2px; }
.attendance-search-empty { padding:20px; background:white; border-radius:8px; color:#777; }
@media (max-width:600px) { .attendance-search-toolbar { flex-direction:column; align-items:stretch; } }
.attendance-month-buttons .attendance-day-button { min-width:0; padding:10px 6px; }
@media (max-width:1200px) { .attendance-month-buttons { grid-template-columns:repeat(6,minmax(0,1fr)); } }
@media (max-width:600px) { .attendance-month-buttons { grid-template-columns:repeat(3,minmax(0,1fr)); } }

/* Menu Học Phí */
.tuition-menu-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 660px; }
.tuition-menu-grid .menu-card { border-top: 0; border-left: 0; border-right: 0; font: inherit; }
@media (max-width: 600px) { .tuition-menu-grid { grid-template-columns: 1fr; } }

.tuition-fee-input { width: 120px; padding: 8px; border: 1px solid var(--border-color); border-radius: 5px; font-size: 14px; }
#tuition-tracking-section table tr > :nth-child(4) { min-width:190px; width:190px; overflow-wrap:anywhere; }
#tuition-tracking-section table tr > :nth-child(6) { width:104px; min-width:104px; padding-left:5px; padding-right:5px; white-space:nowrap; }
#tuition-tracking-section .tuition-fee-input { width:94px; padding:7px 5px; }
#tuition-tracking-section table { width:max-content; min-width:100%; }
#tuition-tracking-section th,
#tuition-tracking-section td { padding:10px 8px; vertical-align:middle; }
#tuition-tracking-section table tr > :nth-child(2) { width:100px; min-width:100px; white-space:nowrap; }
#tuition-tracking-section table tr > :nth-child(3) { width:64px; min-width:64px; text-align:center; }
#tuition-tracking-section table tr > :nth-child(n+8) { width:42px; min-width:42px; padding:10px 5px; text-align:center; }
#tuition-tracking-section table tr > :nth-child(n+8):nth-child(even) { border-left:1px solid #eee; }
#tuition-tracking-section table tr > :nth-child(n+9):nth-child(odd) { width:36px; min-width:36px; }
#tuition-tracking-section table { border-collapse:separate; border-spacing:0; }
#tuition-tracking-section table tr > :nth-child(-n+4) { position:sticky; z-index:2; background:#fff; }
#tuition-tracking-section table tr > :nth-child(2) { left:var(--tuition-code-left,48px); }
#tuition-tracking-section table tr > :nth-child(3) { left:var(--tuition-photo-left,148px); }
#tuition-tracking-section table tr > :nth-child(4) { left:var(--tuition-name-left,212px); box-shadow:3px 0 4px rgba(0,0,0,.12); }
#tuition-tracking-section table tr > th:nth-child(-n+4) { z-index:3; background:#f8f9fa; }
#tuition-tracking-section table tr > :nth-child(n+32) { width:120px; min-width:120px; padding:10px 8px; white-space:nowrap; text-align:right; }
#tuition-tracking-section table tr > th:nth-child(n+32) { text-align:center; }
#tuition-tracking-section table tr > :nth-child(32) { width:100px; min-width:100px; padding-left:5px; padding-right:5px; }
#tuition-tracking-section table tr > :nth-child(36) { width:115px; min-width:115px; padding-left:5px; padding-right:5px; }
.tuition-month-confirmation { width: 20px; height: 20px; accent-color: var(--primary-red); cursor: pointer; }
.tuition-month-confirmation:focus-visible { outline: 2px solid var(--primary-gold); outline-offset: 3px; }
.tuition-month-confirmation:disabled { cursor: default; }

/* Entire camera dialog reflects the scan result; the live video stays visible. */
.face-camera-content { background:#fff; transition:background-color .2s,color .2s; }
.face-camera-content[data-scan-state="success"] { background:#1976d2; color:#fff; }
.face-camera-content[data-scan-state="error"] { background:#c62828; color:#fff; }
.face-camera-content[data-scan-state="success"] .face-camera-note,
.face-camera-content[data-scan-state="error"] .face-camera-note { color:#fff; }
.face-camera-content[data-scan-state="success"] #face-camera-success { background:#e3f2fd !important; color:#0d47a1 !important; border-color:#90caf9 !important; }


#tuition-tracking-section .tuition-receivable-amount { vertical-align:middle; font-weight:700; background:#fff9e9; border-left:1px solid #e3d4b1; }
#tuition-tracking-section .tuition-receivable-amount[hidden] { display:none; }
#tuition-tracking-section .tuition-monthly-amount.tuition-monthly-positive { background:#1976d2; color:#fff; font-weight:700; }
#tuition-tracking-section .tuition-outstanding-amount.tuition-outstanding-positive { background:#c62828; color:#fff; }
#tuition-tracking-section .tuition-total-amount.tuition-total-positive { background:#1565c0; color:#ffeb3b; }
#tuition-tracking-section .tuition-total-amount { font-weight:700; }
#tuition-tracking-section .tuition-receivable-amount.tuition-receivable-positive { background:#c62828; color:#ffeb3b; }

#tuition-tracking-section table tr > :nth-child(7) { width:140px; min-width:140px; white-space:nowrap; text-align:center; }
.tuition-start-date-input { width:120px; padding:7px 5px; border:1px solid var(--border-color); border-radius:5px; font-size:14px; text-align:center; }
#tuition-tracking-section table tr > .tuition-note-cell,
#tuition-tracking-section table tr > :nth-child(37) { width:120px; min-width:120px; max-width:120px; white-space:pre-wrap; overflow-wrap:anywhere; text-align:left; vertical-align:middle; }
#tuition-tracking-section .tuition-note-cell[hidden] { display:none; }
.tuition-note-input { display:block; width:100%; min-height:40px; max-height:80px; padding:5px; border:1px solid var(--border-color); border-radius:5px; font-size:13px; line-height:1.4; resize:none; overflow-y:auto; white-space:pre-wrap; overflow-wrap:anywhere; }

#tuition-tracking-section table tr > :nth-child(n+8):nth-child(-n+30):nth-child(even) { width:34px; min-width:34px; padding-left:3px; padding-right:3px; }

#tuition-tracking-section table tr > :nth-child(n+9):nth-child(-n+31):nth-child(odd) { width:28px; min-width:28px; padding-left:2px; padding-right:2px; }
#tuition-tracking-section table tr > :nth-child(1) { width:48px; min-width:48px; text-align:center; left:0; }

#tuition-tracking-section table tr > .tuition-note-cell,
#tuition-tracking-section table tr > :nth-child(37) { width:300px; min-width:300px; max-width:300px; }
#tuition-tracking-section .tuition-note-input { width:280px; min-width:280px; max-width:280px; min-height:56px; padding:8px; font-size:14px; line-height:1.5; writing-mode:horizontal-tb; direction:ltr; text-align:left; white-space:pre-wrap; word-break:normal; overflow-wrap:break-word; overflow-x:hidden; overflow-y:auto; }

#tuition-tracking-section th, #tuition-tracking-section td { padding-top:6px; padding-bottom:6px; }
#tuition-tracking-section .avatar-small { width:34px; height:34px; }
#tuition-tracking-section .tuition-note-input { min-height:40px; max-height:64px; padding-top:5px; padding-bottom:5px; line-height:1.35; }
#tuition-tracking-section table tr > :nth-child(n) { padding-top:6px; padding-bottom:6px; }
.tuition-search-offer-row { display:flex; gap:16px; align-items:flex-start; flex-wrap:wrap; margin:14px 0; }
.tuition-search-offer-row .attendance-search-label { flex:1 1 260px; width:auto; max-width:480px; }

.tuition-search-offer-row .attendance-search-label[for='tuition-offer'] { flex:0 0 76px; width:76px; max-width:76px; }
#tuition-offer { text-align:center; padding:11px 8px; }
#new-students-this-month { color:#1565c0; }
.student-registered-site { margin-top:4px; font-size:12px; color:#555; }
.student-site-filter-row { display:flex; flex-wrap:wrap; align-items:center; gap:16px; margin-bottom:16px; }
.student-site-filter-row label { display:flex; flex-wrap:wrap; align-items:center; gap:10px; font-weight:700; }
#student-site-filter { padding:9px 12px; min-width:220px; max-width:100%; border:1px solid var(--border-color); border-radius:6px; background:#fff; }
#student-site-filter-summary { color:#555; font-size:14px; }
#student-records-search { padding:10px 12px; width:360px; max-width:100%; border:1px solid var(--border-color); border-radius:6px; font-size:14px; }
#student-table-body tr[hidden] { display:none; }
#attendance-list .monthly-attendance-table tr.attendance-status-reserved > td {
    background:#fff3a3;
    color:#b91c1c;
}
#attendance-list .monthly-attendance-table tr.attendance-status-reserved > td * {
    color:#b91c1c !important;
}
#accounts-menu-card[hidden] { display:none; }
#settings-account-management[hidden] { display:none; }
#face-cooldown-save[hidden] { display:none; }
#tuition-receipts-section th:nth-child(5),#tuition-receipts-section .cash-description-cell { min-width:280px; white-space:pre-wrap; overflow-wrap:anywhere; }
.cash-description-input { width:100%; min-width:240px; padding:9px; border:1px solid var(--border-color); border-radius:6px; font:inherit; resize:vertical; }
#tuition-receipts-section .cash-amount-cell { min-width:150px; text-align:right; white-space:nowrap; }
#tuition-receipts-section .cash-outstanding-amount { min-width:130px; text-align:right; white-space:nowrap; }
#tuition-receipts-section .cash-notice-cell { min-width:180px; white-space:pre-wrap; overflow-wrap:anywhere; }
#tuition-receipts-section .cash-notice-time-cell { min-width:150px; white-space:nowrap; }
#tuition-receipts-section .cash-payment-code-cell { min-width:150px; white-space:nowrap; }
#tuition-receipts-section .cash-collected-amount-cell { min-width:150px; text-align:right; white-space:nowrap; }
#tuition-receipts-section .cash-collected-date-cell { min-width:130px; text-align:center; white-space:nowrap; }
#tuition-receipts-section .cash-difference-cell { min-width:130px; text-align:right; white-space:nowrap; }
#tuition-receipts-section .cash-paid-cell { min-width:100px; text-align:center; white-space:nowrap; }
.cash-group-member + .cash-group-member { margin-top:10px; padding-top:10px; border-top:1px solid #e5e7eb; }
.cash-group-label { font-size:12px; color:#666; margin-bottom:5px; }
#tuition-receipts-section details { margin-top:8px; }
#tuition-receipts-section summary { cursor:pointer; color:#555; }
#tuition-receipts-section .cash-group-outstanding { min-width:130px; text-align:right; white-space:nowrap; }
#tuition-receipts-section .cash-payment-deadline-cell { min-width:140px; text-align:center; white-space:nowrap; }
#tuition-tracking-section .tuition-payment-method { min-width:160px; white-space:nowrap; text-align:center; }
#accounts-create-section[hidden],#accounts-list-section[hidden] { display:none; }
#settings-default-site { display:block; margin-top:10px; min-width:220px; max-width:100%; padding:10px 12px; border:1px solid var(--border-color); border-radius:6px; background:#fff; }
body.staff-readonly button[onclick="scanFace()"] { display:none; }
body.face-profiles-readonly #student-table-body .student-delete-action,
#student-table-body .student-delete-action[hidden] { display:none; }
.account-help { margin:12px 0; line-height:1.6; color:#555; }
.account-create-grid { display:flex; flex-wrap:wrap; align-items:flex-end; gap:16px; }
.account-create-grid label { display:flex; flex-direction:column; gap:8px; flex:1 1 210px; font-weight:700; }
.account-create-grid input,.account-create-grid select,#accounts-table-body select { padding:10px; border:1px solid var(--border-color); border-radius:6px; max-width:100%; font-size:14px; }
#accounts-message { margin-top:12px; }
#accounts-table-body button { margin:4px; }
body.staff-readonly #student-table-body button,
body.staff-readonly button[onclick="openAddStudentModal()"],
body.staff-readonly button[onclick*="openFaceCamera"],
body.staff-readonly button[onclick*="face-id-section"] { display:none; }

#tuition-tracking-section #tuition-tracking-body tr.tuition-status-empty > td {
    background:#fff3a3;
    color:#b91c1c;
    font-weight:700;
}
#tuition-tracking-section #tuition-tracking-body tr.tuition-status-empty > td * {
    color:#b91c1c !important;
    font-weight:700 !important;
}
#tuition-tracking-section #tuition-tracking-body tr.tuition-status-empty input,
#tuition-tracking-section #tuition-tracking-body tr.tuition-status-empty textarea {
    background:#fff8cc;
}
#tuition-tracking-section table tr > :nth-child(5) { width:160px; min-width:160px; white-space:normal; text-align:center; }

.cash-collected-date-input { min-width: 145px; padding: 8px; border: 1px solid #ccc; border-radius: 4px; font: inherit; }

.cash-deadline-input { min-width: 130px; width: 150px; padding: 8px; border: 1px solid #ccc; border-radius: 4px; font: inherit; }

.cash-menu-entry { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cash-menu-entry input { width: 280px; max-width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid #ccc; border-radius: 6px; font: inherit; }
#tuition-receipts-section .action-header { flex-wrap: wrap; gap: 12px; }

#tuition-receipts-section table th:nth-child(13),
#tuition-receipts-section .cash-create-order-cell {
    min-width: 90px;
    white-space: nowrap;
}

.cash-deadline-day-label { color: #dc2626; font-weight: 700; }
.cash-menu-entry #cash-menu-input { width: 68px; text-align: center; }

#tuition-receipts-section table th:nth-child(4),
#tuition-receipts-section .cash-payment-deadline-cell {
    width: 112px;
    min-width: 112px;
    white-space: nowrap;
}
#tuition-receipts-section .cash-deadline-input {
    width: 106px;
    min-width: 0;
    box-sizing: border-box;
    padding: 6px 4px;
    text-align: center;
}

#tuition-receipts-section .cash-notice-input {
    width: 52px;
    min-width: 0;
    box-sizing: border-box;
    padding: 7px 4px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font: inherit;
    text-align: center;
}

#tuition-receipts-section .cash-notice-time-cell { white-space: nowrap; }

#tuition-receipts-section .cash-create-order-button {
    background: #ffeb3b;
    color: #c62828;
    border: 1px solid #e0b800;
    border-radius: 5px;
    padding: 8px 12px;
    font: inherit;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
}
#tuition-receipts-section .cash-create-order-button:hover { background: #ffe033; }
#tuition-receipts-section .cash-create-order-button:focus-visible { outline: 2px solid #c62828; outline-offset: 2px; }

#cash-collection-dialog { width: min(1050px, 92vw); max-height: 88vh; overflow: auto; border: 0; border-radius: 12px; padding: 24px; box-shadow: 0 12px 48px #0004; }
#cash-collection-dialog::backdrop { background: #0007; }
#cash-collection-dialog table { width: 100%; border-collapse: collapse; }
#cash-collection-dialog th, #cash-collection-dialog td { padding: 10px; border: 1px solid #ddd; }
#cash-collection-dialog th { background: #fff3bf; color: #333; }
.cash-collection-fields { display: flex; flex-wrap: wrap; gap: 16px; margin: 18px 0; }
.cash-collection-fields label { display: flex; flex-direction: column; gap: 6px; }
.cash-collection-fields input, .cash-collection-fields textarea { padding: 8px; border: 1px solid #bbb; border-radius: 4px; font: inherit; }

.cash-receipt-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 16px 0; }
.cash-receipt-actions select { padding: 8px; }

#cash-collection-dialog .cash-create-receipt-button {
    background: #90caf9;
    color: #b71c1c;
    border: 1px solid #64b5f6;
    border-radius: 5px;
    padding: 10px 18px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
#cash-collection-dialog .cash-create-receipt-button:hover { background: #64b5f6; }

#cash-collection-dialog .cash-create-receipt-button {
    display: block;
    margin-left: auto;
    background: #2196f3;
    border-color: #1976d2;
    color: #b71c1c;
}
#cash-collection-dialog .cash-create-receipt-button:hover { background: #1e88e5; }

#cash-collection-dialog .cash-close-collection-button {
    background: #c62828;
    color: #ffeb3b;
    border: 1px solid #b71c1c;
    border-radius: 5px;
    padding: 10px 18px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
#cash-collection-dialog .cash-close-collection-button:hover { background: #b71c1c; }

#cash-collection-dialog .cash-create-receipt-button { color: #ffffff; }

#cash-collection-dialog .cash-print-receipt-button {
    background: #ffeb3b;
    color: #000;
    font-weight: 700;
    border: 1px solid #e0b800;
    border-radius: 5px;
    padding: 10px 18px;
    cursor: pointer;
}
#cash-collection-dialog .cash-print-receipt-button:hover { background: #fdd835; }

#cash-collection-dialog .cash-dialog-drag-handle {
    cursor: grab;
    touch-action: none;
    user-select: none;
    padding: 10px 0;
}
#cash-collection-dialog .cash-dialog-drag-handle.dragging { cursor: grabbing; }

#cash-saved-receipts table { width: 100%; border-collapse: collapse; table-layout: auto; }
#cash-saved-receipts th, #cash-saved-receipts td {
    padding: 10px 12px;
    vertical-align: middle;
    line-height: 1.5;
    height: auto;
}
#cash-saved-receipts th { white-space: nowrap; }
#cash-saved-receipts td:nth-child(1),
#cash-saved-receipts td:nth-child(6),
#cash-saved-receipts td:nth-child(9) { white-space: nowrap; }
#cash-saved-receipts td:nth-child(1),
#cash-saved-receipts td:nth-child(7),
#cash-saved-receipts td:nth-child(9) { text-align: center; }
#cash-saved-receipts td:nth-child(5),
#cash-saved-receipts td:nth-child(6) { text-align: right; font-variant-numeric: tabular-nums; }
#cash-saved-receipts td:nth-child(2) { min-width: 160px; }
#cash-saved-receipts td:nth-child(3) { min-width: 150px; overflow-wrap: anywhere; }
#cash-saved-receipts td:nth-child(4) { min-width: 150px; }
#cash-saved-receipts td:nth-child(8) { min-width: 140px; }
#cash-saved-receipts td:nth-child(2),
#cash-saved-receipts td:nth-child(4),
#cash-saved-receipts td:nth-child(7),
#cash-saved-receipts td:nth-child(8) { white-space: normal; overflow-wrap: anywhere; }
#cash-saved-receipts td button { white-space: nowrap; }

#cash-receipt-search { display: block; width: 100%; max-width: 600px; box-sizing: border-box; margin-top: 8px; padding: 11px 14px; border: 1px solid #bbb; border-radius: 6px; font: inherit; }
#cash-receipt-search-summary { color: #555; margin: 10px 0; }

/* Thu TM: size rows to their content and keep grouped members readable. */
#tuition-receipts-section table { width: 100%; table-layout: auto; border-collapse: collapse; }
#tuition-receipts-section table th,
#tuition-receipts-section table td {
    padding: 10px 12px;
    height: auto;
    vertical-align: middle;
    line-height: 1.5;
}
#tuition-receipts-section table th { white-space: nowrap; }
#tuition-receipts-section table td:nth-child(1),
#tuition-receipts-section table td:nth-child(4),
#tuition-receipts-section table td:nth-child(6),
#tuition-receipts-section table td:nth-child(8),
#tuition-receipts-section table td:nth-child(9),
#tuition-receipts-section table td:nth-child(11),
#tuition-receipts-section table td:nth-child(12),
#tuition-receipts-section table td:nth-child(13) { white-space: nowrap; }
#tuition-receipts-section table td:nth-child(3) { min-width: 180px; }
#tuition-receipts-section table td:nth-child(5) { min-width: 150px; }
#tuition-receipts-section table td:nth-child(3),
#tuition-receipts-section table td:nth-child(5) { white-space: normal; overflow-wrap: anywhere; }
#tuition-receipts-section table td:nth-child(6),
#tuition-receipts-section table td:nth-child(7),
#tuition-receipts-section table td:nth-child(11),
#tuition-receipts-section table td:nth-child(14) { text-align: right; font-variant-numeric: tabular-nums; }
#tuition-receipts-section table td:nth-child(2),
#tuition-receipts-section table td:nth-child(4),
#tuition-receipts-section table td:nth-child(8),
#tuition-receipts-section table td:nth-child(9),
#tuition-receipts-section table td:nth-child(12),
#tuition-receipts-section table td:nth-child(13),
#tuition-receipts-section table td:nth-child(15) { text-align: center; }
#tuition-receipts-section .cash-group-member { height: auto; padding: 7px 0; }
#tuition-receipts-section .cash-group-label { white-space: normal; font-size: 12px; line-height: 1.4; margin-bottom: 3px; }
#tuition-receipts-section .cash-payment-code-cell { white-space: nowrap; }
#tuition-receipts-section .avatar-small { object-fit: cover; vertical-align: middle; }

#tuition-receipts-section .table-container { position: relative; overflow-x: auto; }
#tuition-receipts-section table th:nth-child(-n+3),
#tuition-receipts-section table td:nth-child(-n+3) {
    position: sticky;
    z-index: 2;
    background-color: #fff;
}
#tuition-receipts-section table th:nth-child(-n+3) { z-index: 3; background-color: #f3f4f6; color: #222; }
#tuition-receipts-section table th:nth-child(1),
#tuition-receipts-section table td:nth-child(1) { left: 0; }
#tuition-receipts-section table th:nth-child(2),
#tuition-receipts-section table td:nth-child(2) { left: var(--cash-sticky-photo-left, 110px); }
#tuition-receipts-section table th:nth-child(3),
#tuition-receipts-section table td:nth-child(3) { left: var(--cash-sticky-name-left, 190px); border-right: 2px solid #ccc; }

#tuition-receipts-section .cash-paid-checkbox { width: 20px; height: 20px; vertical-align: middle; cursor: pointer; }

#tuition-receipts-section td.cash-difference-cell.cash-difference-negative { background-color:#dc2626; color:#fff; }
#tuition-receipts-section td.cash-difference-cell.cash-difference-positive { background-color:#15803d; color:#fff; }

.cash-delete-receipt-button { margin-left:8px; background:#dc2626; color:#fff; border:1px solid #dc2626; border-radius:5px; padding:6px 12px; cursor:pointer; }
.cash-delete-receipt-button:hover { background:#b91c1c; }
/* Thu TM: content-sized columns and a scroll area that fits the screen. */
#tuition-receipts-section { width:100%; max-width:1920px; padding:16px 20px; margin:20px auto; }
#tuition-receipts-section > .table-container { padding:14px; }
#tuition-receipts-section .table-container { max-width:100%; max-height:calc(100vh - 260px); min-height:200px; overflow:auto; }
#tuition-receipts-section table { min-width:0; width:100%; margin-top:0; }
#tuition-receipts-section table th,
#tuition-receipts-section table td { min-width:0; height:auto; padding:8px 10px; line-height:1.4; }
#tuition-receipts-section table th { position:sticky; top:0; z-index:1; white-space:normal; vertical-align:middle; background:#f3f4f6; }
#tuition-receipts-section table th:nth-child(-n+3) { z-index:4; }
#tuition-receipts-section table tr > :nth-child(1) { min-width:100px; white-space:nowrap; }
#tuition-receipts-section table tr > :nth-child(2) { width:60px; min-width:60px; }
#tuition-receipts-section table tr > :nth-child(3) { min-width:180px; max-width:250px; white-space:normal; overflow-wrap:break-word; }
#tuition-receipts-section table tr > :nth-child(4) { width:105px; min-width:105px; }
#tuition-receipts-section table tr > :nth-child(5) { min-width:170px; max-width:260px; white-space:pre-wrap; overflow-wrap:break-word; }
#tuition-receipts-section table tr > :nth-child(6),
#tuition-receipts-section table tr > :nth-child(11),
#tuition-receipts-section table tr > :nth-child(14) { min-width:118px; white-space:nowrap; }
#tuition-receipts-section table tr > :nth-child(7) { min-width:145px; }
#tuition-receipts-section table tr > :nth-child(8) { width:76px; min-width:76px; }
#tuition-receipts-section table tr > :nth-child(9) { min-width:155px; white-space:nowrap; }
#tuition-receipts-section table tr > :nth-child(10) { min-width:166px; white-space:nowrap; }
#tuition-receipts-section table tr > :nth-child(12) { min-width:105px; white-space:nowrap; }
#tuition-receipts-section table tr > :nth-child(13) { width:100px; min-width:100px; }
#tuition-receipts-section table tr > :nth-child(15) { width:70px; min-width:70px; }
#tuition-receipts-section .cash-notice-input { width:52px; min-width:0; height:34px; padding:6px; box-sizing:border-box; }
#tuition-receipts-section .cash-create-order-button { min-width:78px; min-height:34px; padding:6px 8px; }
#tuition-receipts-section .avatar-small { width:36px; height:36px; display:block; margin:0 auto; }
#tuition-receipts-section .cash-group-member { padding:4px 0; }
#tuition-receipts-section .cash-group-member + .cash-group-member { margin-top:4px; padding-top:6px; }
#tuition-receipts-section .cash-group-label { margin-bottom:2px; }
#tuition-receipts-section .cash-paid-checkbox { margin:0; }
#cash-students-summary { margin:10px 0 14px; line-height:1.5; }
@media (max-width:600px) {
    #tuition-receipts-section { padding:10px 8px; margin:12px auto; }
    #tuition-receipts-section .table-container { padding:8px; max-height:calc(100dvh - 230px); }
    #tuition-receipts-section table th:nth-child(2),
    #tuition-receipts-section table th:nth-child(3) { left:auto; z-index:1; }
    #tuition-receipts-section table td:nth-child(2),
    #tuition-receipts-section table td:nth-child(3) { position:static; }
}

#tuition-tracking-section .cash-month-shortfall, #tuition-receipts-section .cash-month-shortfall { color:#dc2626 !important; font-weight:700; }

#tuition-tracking-section .cash-student-code,
#tuition-receipts-section .cash-student-code { display:inline-block; padding:4px 6px; border-radius:4px; white-space:nowrap; }
#tuition-tracking-section .cash-student-code.cash-month-shortfall,
#tuition-receipts-section .cash-student-code.cash-month-shortfall { background-color:#dc2626; color:#fff !important; font-weight:700; }

#tuition-transfer-receipts-section { max-width:1600px; }
#tuition-transfer-receipts-section .table-container { margin-top:14px; }
#tuition-transfer-receipts-section td { height:auto; vertical-align:middle; line-height:1.5; }
#tuition-transfer-receipts-section td:nth-child(3) { min-width:200px; }
#tuition-transfer-receipts-section td:nth-child(n+5) { text-align:right; white-space:nowrap; font-variant-numeric:tabular-nums; }
#tuition-transfer-receipts-section .cash-month-shortfall { color:#dc2626 !important; }
#tuition-transfer-receipts-section .cash-student-code { display:inline-block; padding:4px 6px; border-radius:4px; white-space:nowrap; }
#tuition-transfer-receipts-section .cash-student-code.cash-month-shortfall { background:#dc2626; color:#fff !important; }

#tuition-transfer-receipts-section .transfer-deadline-cell { min-width:110px; white-space:nowrap; text-align:center; }

#tuition-transfer-receipts-section td.transfer-description-cell { min-width:180px; max-width:300px; text-align:left; white-space:pre-wrap; overflow-wrap:break-word; }

#tuition-transfer-receipts-section td.cash-notice-cell { min-width:76px; text-align:center; }
#tuition-transfer-receipts-section .cash-notice-input { width:52px; min-width:0; height:34px; padding:6px; border:1px solid #ccc; border-radius:4px; font:inherit; text-align:center; box-sizing:border-box; }

#tuition-transfer-receipts-section td.cash-notice-time-cell { min-width:155px; text-align:center; white-space:nowrap; }

#tuition-transfer-receipts-section .cash-payment-code-cell { min-width:165px; white-space:nowrap; text-align:left; }

#tuition-transfer-receipts-section .transfer-amount-input { width:150px; padding:8px; border:1px solid #ccc; border-radius:4px; font:inherit; text-align:right; }


#tuition-transfer-receipts-section td.cash-difference-cell { min-width:118px; white-space:nowrap; text-align:right; }
#tuition-transfer-receipts-section td.cash-difference-negative { background:#dc2626; color:#fff; }
#tuition-transfer-receipts-section td.cash-difference-positive { background:#15803d; color:#fff; }

#tuition-transfer-receipts-section td.cash-paid-cell { min-width:70px; text-align:center; }
#tuition-transfer-receipts-section .cash-paid-checkbox { width:20px; height:20px; vertical-align:middle; cursor:pointer; }

.bank-url-controls { display:flex; align-items:center; flex-wrap:wrap; gap:12px; margin:10px 0; }
#bank-sheet-url { flex:1 1 340px; min-width:0; max-width:100%; padding:11px 12px; border:1px solid #ccc; border-radius:6px; font:inherit; }
#bank-url-status { margin-top:10px; line-height:1.5; }
#bank-url-open[hidden],#bank-url-save[hidden] { display:none; }

#bank-transactions { margin-top:22px; }
#bank-transactions > p { margin:10px 0; line-height:1.5; }
#bank-transactions td:nth-child(5) { white-space:nowrap; text-align:right; color:#15803d; font-weight:700; }
#bank-transactions td:nth-child(6) { min-width:220px; overflow-wrap:anywhere; }

#tuition-transfer-receipts-section .transfer-amount-input[readonly] { background:#f3f4f6; color:#333; cursor:default; }

#tuition-transfer-receipts-section td.transfer-date-cell { min-width:120px; white-space:normal; text-align:center; line-height:1.5; }

#tuition-tracking-section td.tuition-overpayment-pending { background-color:#1976d2 !important; color:#fff !important; }
#tuition-tracking-section td.tuition-overpayment-pending .cash-student-code { background:transparent !important; color:#fff !important; font-weight:700; }

/* Chuyển Khoản: size columns by content and wrap descriptive text. */
#tuition-transfer-receipts-section .table-container { padding:12px; max-width:100%; overflow-x:auto; }
#tuition-transfer-receipts-section table { table-layout:auto; width:100%; min-width:1250px; }
#tuition-transfer-receipts-section th,
#tuition-transfer-receipts-section td { padding:10px 8px; box-sizing:border-box; }
#tuition-transfer-receipts-section th { white-space:nowrap; text-align:center; }
#tuition-transfer-receipts-section th:nth-child(1),
#tuition-transfer-receipts-section td:nth-child(1) { width:1%; min-width:80px; white-space:nowrap; text-align:center; }
#tuition-transfer-receipts-section th:nth-child(2),
#tuition-transfer-receipts-section td:nth-child(2) { width:56px; min-width:56px; text-align:center; }
#tuition-transfer-receipts-section .avatar-small { width:36px; height:36px; display:block; margin:auto; }
#tuition-transfer-receipts-section td:nth-child(3) { width:220px; min-width:190px; max-width:280px; white-space:normal; overflow-wrap:anywhere; text-align:left; }
#tuition-transfer-receipts-section td.transfer-description-cell { width:240px; min-width:180px; max-width:300px; white-space:pre-wrap; overflow-wrap:anywhere; text-align:left; }
#tuition-transfer-receipts-section td.transfer-deadline-cell { width:1%; min-width:100px; text-align:center; }
#tuition-transfer-receipts-section td:nth-child(6),
#tuition-transfer-receipts-section td:nth-child(7),
#tuition-transfer-receipts-section td.transfer-amount-cell,
#tuition-transfer-receipts-section td.cash-difference-cell { width:1%; min-width:105px; white-space:nowrap; text-align:right; font-variant-numeric:tabular-nums; }
#tuition-transfer-receipts-section td.cash-notice-cell { width:68px; min-width:68px; text-align:center; }
#tuition-transfer-receipts-section td.cash-notice-time-cell { width:1%; min-width:140px; white-space:normal; text-align:center; }
#tuition-transfer-receipts-section td.cash-payment-code-cell { width:1%; min-width:140px; white-space:nowrap; text-align:left; }
#tuition-transfer-receipts-section td.transfer-date-cell { width:125px; min-width:105px; max-width:180px; white-space:normal; overflow-wrap:break-word; text-align:center; }
#tuition-transfer-receipts-section td.cash-paid-cell { width:68px; min-width:68px; text-align:center; }
@media (max-width:768px) {
    #tuition-transfer-receipts-section .table-container { padding:6px; }
    #tuition-transfer-receipts-section th,
    #tuition-transfer-receipts-section td { padding:8px 6px; }
}

.zalo-template-fields { display:flex; align-items:flex-end; flex-wrap:wrap; gap:16px; margin:8px 0 16px; }
.zalo-template-fields label { display:block; margin-bottom:8px; }
.zalo-template-fields select, .zalo-template-fields input { display:block; box-sizing:border-box; padding:10px; margin:0; font:inherit; }
.zalo-template-fields #zalo-template-number { width:12ch; max-width:100%; }

.zalo-template-fields #zalo-template-number-extra { width:12ch; max-width:100%; }

.zalo-template-fields #zalo-template-number-third { width:12ch; max-width:100%; }

/* Highlight payment deadlines in both collection tables. */
#bank-manual-form { margin:18px 0; padding:14px; border:1px solid #bfdbfe; border-radius:8px; background:#eff6ff; }
#bank-manual-form input { width:100%; min-width:130px; padding:8px; box-sizing:border-box; font:inherit; }
.cash-pending-total-box { display:inline-block; margin:0 0 14px; padding:12px 16px; border:1px solid #f59e0b; border-radius:6px; background:#fffbeb; color:#92400e; }
.receipt-date-filters { display:flex; flex-wrap:wrap; align-items:flex-end; gap:12px; margin-top:14px; }
.receipt-date-filters label { display:flex; flex-direction:column; gap:6px; }
.receipt-date-filters input { padding:9px; border:1px solid #bbb; border-radius:6px; font:inherit; }
.receipt-date-filters button { padding:10px 14px; cursor:pointer; }
.receipt-filter-total { font-size:1.15em; font-weight:700; color:#1d4ed8; }
#tuition-transfer-receipts-section td.transfer-group-name-cell { vertical-align:middle; }
#tuition-transfer-receipts-section td[hidden] { display:none; }

#tuition-receipts-section table thead th:nth-child(10),
#tuition-receipts-section table thead th:nth-child(11),
#tuition-receipts-section table thead th:nth-child(12),
#tuition-transfer-receipts-section table thead th:nth-child(10),
#tuition-transfer-receipts-section table thead th:nth-child(11),
#tuition-transfer-receipts-section table thead th:nth-child(12) {
    background-color: #ffff00;
    color: #dc2626;
}

#tuition-receipts-section table thead th:nth-child(8),
#tuition-receipts-section table thead th:nth-child(9),
#tuition-transfer-receipts-section table thead th:nth-child(8),
#tuition-transfer-receipts-section table thead th:nth-child(9) {
    background-color: #d97706;
    color: #fff;
}

#tuition-receipts-section table thead th:nth-child(13),
#tuition-receipts-section table thead th:nth-child(15),
#tuition-transfer-receipts-section table thead th:nth-child(14),
#tuition-receipts-section table thead th:nth-child(-n+3),
#tuition-transfer-receipts-section table thead th:nth-child(-n+3) {
    background-color: #2563eb;
    color: #ffff00;
}

#tuition-receipts-section table thead th:nth-child(5),
#tuition-transfer-receipts-section table thead th:nth-child(5),
#tuition-receipts-section table thead th:nth-child(6),
#tuition-transfer-receipts-section table thead th:nth-child(6) {
    background-color: #2563eb;
    color: #fff;
}

.description-display { display:flex; align-items:center; justify-content:center; gap:6px; white-space:normal; }
.description-display > div { min-width:0; white-space:pre-wrap; overflow-wrap:anywhere; }
.description-edit-button { display:inline-flex; flex-shrink:0; align-items:center; justify-content:center; margin:0; padding:4px 8px; cursor:pointer; }
.description-edit-input { width:100%; min-width:150px; box-sizing:border-box; font:inherit; padding:6px; white-space:pre-wrap; }
.description-edit-actions { display:flex; justify-content:center; gap:8px; margin-top:6px; }
.description-edit-actions button { padding:5px 12px; cursor:pointer; }

#tuition-receipts-section table tbody td.cash-description-cell,
#tuition-receipts-section table tbody td.cash-payment-code-cell,
#tuition-transfer-receipts-section table tbody td.transfer-description-cell,
#tuition-transfer-receipts-section table tbody td.cash-payment-code-cell {
    text-align: center;
    vertical-align: middle;
}

#tuition-receipts-section table tbody td.cash-amount-cell,
#tuition-receipts-section table tbody td.cash-outstanding-amount,
#tuition-receipts-section table tbody td.cash-collected-amount-cell,
#tuition-transfer-receipts-section table tbody td:nth-child(6),
#tuition-transfer-receipts-section table tbody td.transfer-outstanding-amount,
#tuition-transfer-receipts-section table tbody td.transfer-amount-cell {
    text-align: center;
    vertical-align: middle;
}

#tuition-receipts-section table thead th,
#tuition-transfer-receipts-section table thead th {
    text-align: center;
    vertical-align: middle;
}

.outstanding-amount-label,
#tuition-receipts-section table th:nth-child(7),
#tuition-transfer-receipts-section table th:nth-child(7) {
    background-color: #dc2626;
    color: #ffff00;
}
.outstanding-amount-label {
    display: inline-block;
    padding: 3px 6px;
    border-radius: 4px;
}

#tuition-receipts-section table th:nth-child(4),
#tuition-receipts-section table th:nth-child(14),
#tuition-transfer-receipts-section table th:nth-child(4),
#tuition-transfer-receipts-section table th:nth-child(13) {
    background-color: #dc2626;
    color: #fff;
}
.payment-deadline-label {
    display: inline-block;
    padding: 3px 6px;
    border-radius: 4px;
    background-color: #dc2626;
    color: #fff;
}
/* Employee entry shares the student form style and fits the page width. */
#employee-avatarInput { display: none; }
#employee-form .personal-info-grid { min-width: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); }
#employee-form input, #employee-form select { min-width: 0; max-width: 100%; }
#employee-schedule-container { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
#employee-schedule-container .form-section { min-width: 0; padding: 14px; }
#employee-schedule-container .personal-info-grid { display: flex; flex-direction: column; margin-top: 12px; }
@media (max-width: 760px) {
    #employee-form .personal-info-layout { flex-direction: column; }
    #employee-form .personal-info-grid { grid-template-columns: minmax(0, 1fr); }
    #employee-form .span-2, #employee-form .span-3 { grid-column: span 1; }
    #employee-form .face-id-group { flex-wrap: wrap; }
}

#employee-form .employee-form-actions { display: flex; justify-content: flex-end; gap: 12px; }
#employee-form .employee-form-actions button[type="submit"] { margin-left: 0; }

#employee-form .employee-form-actions .btn-back { background: #e0e0e0; color: #000; border-color: #e0e0e0; }
#employee-form .employee-form-actions .btn-back:hover { background: #ccc; color: #000; border-color: #ccc; }

#reception-attendance-section td.reception-checked-in-today { background-color:#15803d; color:#fff; font-weight:700; }

/* Compact day columns; readable employee details. */
#coach-attendance-section .coach-attendance-table { width:max-content; min-width:100%; table-layout:auto; }
#coach-attendance-section .coach-attendance-table th,
#coach-attendance-section .coach-attendance-table td { padding:8px 6px; vertical-align:middle; }
#coach-attendance-section .coach-attendance-table tr > :nth-child(1) { width:44px; min-width:44px; text-align:center; white-space:nowrap; }
#coach-attendance-section .coach-attendance-table tr > :nth-child(2) { min-width:85px; white-space:nowrap; }
#coach-attendance-section .coach-attendance-table tr > :nth-child(3) { min-width:180px; max-width:240px; overflow-wrap:anywhere; }
#coach-attendance-section .coach-attendance-table tr > :nth-child(4) { min-width:125px; max-width:160px; }
#coach-attendance-section .coach-attendance-table tr > :nth-child(n+6) { width:34px; min-width:34px; padding:8px 4px; text-align:center; white-space:nowrap; }
#coach-attendance-section .coach-attendance-table input[type="checkbox"] { display:block; margin:0 auto; }

#coach-attendance-section .coach-attendance-table tr > :nth-child(5) { min-width:120px; white-space:nowrap; }

#coach-attendance-section .coach-attendance-table tr > :nth-child(n+6) { min-width:80px; width:80px; }

#coach-attendance-section .coach-attendance-table { border-collapse:separate; border-spacing:0; }
#coach-attendance-section .coach-attendance-table tr > :nth-child(-n+5) { position:sticky; z-index:2; background:#fff; }
#coach-attendance-section .coach-attendance-table tr > :nth-child(1) { left:var(--coach-left-0,0px); }
#coach-attendance-section .coach-attendance-table tr > :nth-child(2) { left:var(--coach-left-1,56px); }
#coach-attendance-section .coach-attendance-table tr > :nth-child(3) { left:var(--coach-left-2,153px); }
#coach-attendance-section .coach-attendance-table tr > :nth-child(4) { left:var(--coach-left-3,345px); }
#coach-attendance-section .coach-attendance-table tr > :nth-child(5) { left:var(--coach-left-4,482px); box-shadow:3px 0 5px #0002; }
#coach-attendance-section .coach-attendance-table thead tr > :nth-child(-n+5) { z-index:3; background:#f8f9fa; }

#coach-attendance-section .coach-attendance-table .coach-total-cell, #coach-attendance-section .coach-attendance-table thead tr > :last-child { position:sticky; right:0; z-index:3; min-width:65px; background:#fff3cf; color:var(--primary-red); font-weight:700; border-left:2px solid var(--primary-gold); }

#attendance-section .monthly-attendance-table .attendance-total-cell { right:110px; }
#attendance-section .monthly-attendance-table tr > :last-child { position:sticky; right:0; min-width:110px; background:#fff; z-index:2; text-align:center; }
#attendance-section .monthly-attendance-table thead tr > :last-child, #attendance-section .monthly-attendance-table tr > th:last-child { background:#f8f9fa; z-index:3; }

#attendance-section .attendance-exam-cell button { font-size:12px; }

.attendance-exam-cell .exam-registered, .attendance-exam-cell .exam-registered:disabled {background:#2563eb;color:#fff;opacity:1;border-color:#2563eb;}

/* Content sizing for the temporary exam list. */
#exam-temporary-section table { width:100%; table-layout:auto; }
#exam-temporary-section th, #exam-temporary-section td { padding:10px 8px; vertical-align:middle; }
#exam-temporary-section th { white-space:nowrap; }
#exam-temporary-section td:nth-child(1),
#exam-temporary-section td:nth-child(2),
#exam-temporary-section td:nth-child(5),
#exam-temporary-section td:nth-child(6),
#exam-temporary-section td:nth-child(7),
#exam-temporary-section td:nth-child(8),
#exam-temporary-section td:nth-child(10),
#exam-temporary-section td:nth-child(11) { white-space:nowrap; }
#exam-temporary-section th:nth-child(1), #exam-temporary-section td:nth-child(1),
#exam-temporary-section th:nth-child(3), #exam-temporary-section td:nth-child(3),
#exam-temporary-section th:nth-child(12), #exam-temporary-section td:nth-child(12) { width:1%; text-align:center; }
#exam-temporary-section td:nth-child(4) { min-width:140px; max-width:220px; white-space:normal; overflow-wrap:break-word; }
#exam-temporary-section td:nth-child(4) div { margin-top:4px; font-size:12px; }
#exam-temporary-section td:nth-child(9) { min-width:100px; max-width:180px; white-space:normal; overflow-wrap:break-word; }
#exam-temporary-section td:nth-child(14) { min-width:160px; }
#exam-temporary-section td:nth-child(14) input { min-width:150px !important; padding:8px; font:inherit; box-sizing:border-box; }
#exam-temporary-section .attendance-student-avatar { display:block; width:48px; height:56px; margin:auto; }

/* Keep temporary exam roster cell contents on one line. */
#exam-temporary-section .form-section { overflow-x:auto; }
#exam-temporary-section table th,
#exam-temporary-section table td,
#exam-temporary-section table td:nth-child(4),
#exam-temporary-section table td:nth-child(9) { white-space:nowrap; overflow-wrap:normal; max-width:none; }

/* Center temporary exam list headings and data. */
#exam-temporary-section table th,
#exam-temporary-section table td { text-align:center; vertical-align:middle; }
#exam-temporary-section table td input[type="text"] { text-align:center; }
#exam-temporary-section table td .attendance-student-avatar { margin-left:auto; margin-right:auto; }

#exam-temporary-section .form-section table th,
#exam-temporary-section .form-section table td { text-align:center !important; vertical-align:middle !important; }
#exam-temporary-section .form-section table td > div,
#exam-temporary-section .form-section table td input[type="text"] { text-align:center !important; }
#exam-temporary-section .form-section table td input[type="checkbox"] { display:block; margin:0 auto; }
#exam-temporary-section .form-section table td button { margin-left:auto; margin-right:auto; }

:is(#exam-official-section, #exam-temporary-section) .exam-delete-all-button {
    background:#dc2626; color:#ffeb3b; border:2px solid #b91c1c;
    font-size:20px; font-weight:700; padding:14px 32px;
    min-height:54px; border-radius:8px; cursor:pointer;
}
:is(#exam-official-section, #exam-temporary-section) .exam-delete-all-button:hover:not(:disabled) { background:#b91c1c; }
:is(#exam-official-section, #exam-temporary-section) .exam-delete-all-button:disabled { opacity:0.6; cursor:default; }

:is(#exam-official-section, #exam-temporary-section) .exam-delete-all-button {
    display:block; margin-left:auto; margin-right:0;
    font-size:17px; padding:10px 24px; min-height:44px;
}

/* Keep exam table headings visible inside the scrolling list. */
:is(#exam-temporary-section, #exam-official-section) .form-section {
    max-height:calc(100vh - 220px);
    overflow:auto;
    position:relative;
}
:is(#exam-temporary-section, #exam-official-section) table {
    border-collapse:separate;
    border-spacing:0;
}
:is(#exam-temporary-section, #exam-official-section) table thead th {
    position:sticky;
    top:0;
    z-index:3;
    background:var(--primary-color, #1a365d);
    color:#fff;
    box-shadow:0 2px 2px rgba(0,0,0,0.12);
}

/* Fit attendance columns to their displayed content. */
#attendance-section .monthly-attendance-table { width:max-content; min-width:100%; table-layout:auto; }
#attendance-section .monthly-attendance-table th,
#attendance-section .monthly-attendance-table td { padding:9px 7px; vertical-align:middle; }
#attendance-section .monthly-attendance-table tr > :nth-child(1) { min-width:95px; white-space:nowrap; }
#attendance-section .monthly-attendance-table tr > :nth-child(2) { width:62px; min-width:62px; text-align:center; }
#attendance-section .monthly-attendance-table tr > :nth-child(3) { min-width:180px; white-space:nowrap; }
#attendance-section .monthly-attendance-table tr > :nth-child(4) { min-width:65px; white-space:nowrap; text-align:center; }
#attendance-section .monthly-attendance-table tr > :nth-child(5) { min-width:110px; white-space:nowrap; text-align:center; }
#attendance-section .monthly-attendance-table .attendance-date-cell { min-width:32px; padding:8px 5px; text-align:center; }
#attendance-section .monthly-attendance-table .attendance-student-avatar { width:48px; height:56px; display:block; margin:auto; }

/* Scroll student rows while keeping the face-attendance toolbar and controls above visible. */
#attendance-section .attendance-site-section > .table-container {
    max-height:55vh;
    overflow:auto;
    overscroll-behavior-y:contain;
    position:relative;
}
#attendance-section .attendance-search-toolbar {
    position:sticky;
    top:48px;
    z-index:10;
    background:#fff9e9;
    box-shadow:0 3px 6px rgba(0,0,0,.08);
}

/* Center attendance row content. */
#attendance-section .monthly-attendance-table tr > th,
#attendance-section .monthly-attendance-table tr > td {
    text-align:center;
    vertical-align:middle;
}
#attendance-section .monthly-attendance-table .attendance-date-cell input {
    display:block;
    margin:0 auto;
}
#attendance-section .monthly-attendance-table .attendance-birth-date { text-align:center; }

/* Keep attendance column headings visible during table scrolling. */
#attendance-section .monthly-attendance-table {
    border-collapse:separate;
    border-spacing:0;
}
#attendance-section .monthly-attendance-table tr:first-child > th {
    position:sticky;
    top:0;
    z-index:5;
    background:#f8f9fa;
    box-shadow:0 2px 3px rgba(0,0,0,.12);
}
#attendance-section .monthly-attendance-table tr:first-child > th:nth-child(-n+3),
#attendance-section .monthly-attendance-table tr:first-child > th.attendance-total-cell,
#attendance-section .monthly-attendance-table tr:first-child > th:last-child { z-index:6; }

/* Sticky column headings for cash and transfer collection lists. */
:is(#tuition-receipts-section, #tuition-transfer-receipts-section) .table-container {
    max-height:65vh;
    overflow:auto;
    position:relative;
}
:is(#tuition-receipts-section, #tuition-transfer-receipts-section) table {
    border-collapse:separate;
    border-spacing:0;
}
:is(#tuition-receipts-section, #tuition-transfer-receipts-section) table thead th {
    position:sticky;
    top:0;
    z-index:5;
    background-color:#f8f9fa;
    box-shadow:0 2px 3px rgba(0,0,0,.12);
}
:is(#tuition-receipts-section, #tuition-transfer-receipts-section) table thead th:nth-child(-n+3) { z-index:6; }

/* Freeze transfer student identifiers while scrolling horizontally. */
#tuition-transfer-receipts-section table tr > :nth-child(-n+3) { position:sticky; z-index:2; }
#tuition-transfer-receipts-section table tbody tr > :nth-child(-n+3) { background:#fff; }
#tuition-transfer-receipts-section table tr > :nth-child(1) { left:0; }
#tuition-transfer-receipts-section table tr > :nth-child(2) { left:var(--transfer-photo-left,104px); }
#tuition-transfer-receipts-section table tr > :nth-child(3) { left:var(--transfer-name-left,184px); border-right:2px solid #ddd; box-shadow:3px 0 4px #0002; }
#tuition-transfer-receipts-section table thead tr > :nth-child(-n+3) { z-index:7; }

/* Keep the payment deadline visible after the three student columns. */
#tuition-transfer-receipts-section table tr > :nth-child(3) { border-right:0; box-shadow:none; }
#tuition-transfer-receipts-section table tr > :nth-child(4) {
    position:sticky;
    left:var(--transfer-deadline-left,398px);
    z-index:2;
    min-width:100px;
    white-space:nowrap;
    border-right:2px solid #ddd;
    box-shadow:3px 0 4px #0002;
}
#tuition-transfer-receipts-section table tbody tr > :nth-child(4) { background:#fff; }
#tuition-transfer-receipts-section table thead tr > :nth-child(4) { z-index:7; }

/* Freeze the three student columns in the transfer list. */
#tuition-transfer-receipts-section table tbody tr > td:nth-child(-n+3) {
    position:sticky;
    z-index:3;
    background:#fff;
}
#tuition-transfer-receipts-section table thead tr > th:nth-child(-n+3) {
    position:sticky;
    top:0;
    z-index:7;
    background:#f8f9fa;
}
#tuition-transfer-receipts-section table tr > :nth-child(1) { left:0; }
#tuition-transfer-receipts-section table tr > :nth-child(2) { left:var(--transfer-photo-left,104px); }
#tuition-transfer-receipts-section table tr > :nth-child(3) {
    left:var(--transfer-name-left,184px);
    border-right:2px solid #ddd;
    box-shadow:3px 0 4px #0002;
}
#tuition-transfer-receipts-section table tbody tr > td:nth-child(4) {
    position:static; left:auto; z-index:auto; border-right:0; box-shadow:none;
}
#tuition-transfer-receipts-section table thead tr > th:nth-child(4) {
    left:auto; z-index:5; border-right:0; box-shadow:0 2px 3px #0002;
}

/* Keep tuition tracking headings visible while scrolling records. */
#tuition-tracking-section .table-container {
    max-height:65vh;
    overflow:auto;
    position:relative;
}
#tuition-tracking-section table {
    border-collapse:separate;
    border-spacing:0;
}
#tuition-tracking-section table thead th {
    position:sticky;
    top:0;
    z-index:5;
    background:#f8f9fa;
    box-shadow:0 2px 3px rgba(0,0,0,.12);
}
#tuition-tracking-section table thead th:nth-child(-n+4) { z-index:6; }

/* Freeze reception attendance table headings. */
#reception-attendance-section .reception-attendance-scroll {
    max-height:60vh; overflow:auto; position:relative;
}
#reception-attendance-section .reception-attendance-scroll table { border-collapse:separate; border-spacing:0; }
#reception-attendance-section .reception-attendance-scroll thead th {
    position:sticky; top:0; z-index:5;
    background:#f8f9fa; box-shadow:0 2px 3px rgba(0,0,0,.12);
}

/* Keep coach attendance column headings visible. */
#coach-attendance-section .coach-attendance-scroll { max-height:65vh; overflow:auto; position:relative; }
#coach-attendance-section .coach-attendance-table thead tr > th {
    position:sticky; top:0; z-index:5;
    background:#f8f9fa; box-shadow:0 2px 3px rgba(0,0,0,.12);
}
#coach-attendance-section .coach-attendance-table thead tr > th:nth-child(-n+5),
#coach-attendance-section .coach-attendance-table thead tr > th:last-child { z-index:6; }

/* Keep student roster column headings visible. */
#student-records-section .table-container {
    max-height:65vh;
    overflow:auto;
    position:relative;
}
#student-records-section .table-container table { border-collapse:separate; border-spacing:0; }
#student-records-section .table-container table thead th {
    position:sticky;
    top:0;
    z-index:5;
    background:#f8f9fa;
    box-shadow:0 2px 3px rgba(0,0,0,.12);
}

/* Keep student lookup headings visible while scrolling results. */
#student-lookup-section .student-lookup-scroll { max-height:65vh; overflow:auto; position:relative; }
#student-lookup-section .student-lookup-scroll table { border-collapse:separate; border-spacing:0; }
#student-lookup-section .student-lookup-scroll thead th {
    position:sticky; top:0; z-index:5;
    background:#f8f9fa; box-shadow:0 2px 3px rgba(0,0,0,.12);
}

.navbar-notifications { position:relative; }
.navbar-notification-button { display:flex; align-items:center; justify-content:center; width:40px; height:38px; border:1px solid #ffffff80; border-radius:8px; background:transparent; color:#fff; font-size:23px; cursor:pointer; }
.navbar-notification-button:hover { background:#ffffff20; }
.navbar-notification-button:focus-visible { outline:2px solid var(--primary-gold); outline-offset:3px; }
.navbar-notification-panel { position:absolute; right:0; top:calc(100% + 12px); width:min(300px,85vw); padding:18px; border:1px solid #ddd; border-radius:10px; background:#fff; color:#333; box-shadow:0 8px 24px #0003; z-index:10001; }
.navbar-notification-panel[hidden] { display:none; }
.navbar-notification-panel p { margin-top:12px; color:#64748b; font-size:14px; font-weight:600; }

/* Parents see only student lookup and attendance in the main menu. */
body.staff-readonly #main-menu-section .menu-card:not(.parent-visible-menu) { display:none !important; }
body.staff-readonly #main-menu-section .main-menu-grid { grid-template-columns:repeat(2,minmax(0,1fr)); max-width:700px; }
@media(max-width:600px) { body.staff-readonly #main-menu-section .main-menu-grid { grid-template-columns:1fr; } }

.navbar-notification-button { position:relative; }
.navbar-notification-badge { position:absolute; top:-6px; right:-7px; min-width:19px; padding:2px 4px; border-radius:12px; background:#ffdf00; color:#a81c1c; font-size:11px; font-weight:700; }
.navbar-notification-badge[hidden] { display:none; }
.navbar-notification-panel { max-height:65vh; overflow-y:auto; }
.navbar-notification-item { padding:10px 0; border-bottom:1px solid #eee; }
.navbar-notification-item small { color:#777; font-weight:400; }

#employee-face-menu-card[hidden] { display:none; }

#student-face-menu-card[hidden] { display:none; }

#tuition-tracking-section #tuition-tracking-body tr.tuition-fee-missing > td {
    background:#fff3a3 !important;
    color:#b91c1c !important;
    font-weight:700;
}
#tuition-tracking-section #tuition-tracking-body tr.tuition-fee-missing > td * {
    color:#b91c1c !important;
    font-weight:700 !important;
}
#tuition-tracking-section #tuition-tracking-body tr.tuition-fee-missing input,
#tuition-tracking-section #tuition-tracking-body tr.tuition-fee-missing textarea {
    background:#fff8cc !important;
}

/* Transfer identifiers scroll horizontally with the rest of the table. */
#tuition-transfer-receipts-section table tbody tr > td:nth-child(-n+3) {
    position:static;
    left:auto;
    z-index:auto;
    border-right:0;
    box-shadow:none;
}
#tuition-transfer-receipts-section table thead tr > th:nth-child(-n+3) {
    position:sticky;
    top:0;
    left:auto;
    z-index:5;
    border-right:0;
    box-shadow:0 2px 3px rgba(0,0,0,.12);
}

/* Blue identifier headings in the transfer list. */
#tuition-transfer-receipts-section table thead tr > th:nth-child(-n+3) {
    background:#1976d2 !important;
    color:#fff !important;
}
#tuition-transfer-receipts-section table thead tr > th:nth-child(-n+3) * {
    color:#fff !important;
}

.notification { font-weight:600; }

.student-face-id-cell { min-width:160px; overflow-wrap:anywhere; }

.student-face-scan-button { padding:8px 16px; border:0; border-radius:6px; font-weight:700; cursor:pointer; }
.student-face-scan-button.has-face { background:#1976d2; color:#ffdf00; opacity:1; cursor:default; }

.student-face-id-heading, .student-face-id-cell { text-align:center; vertical-align:middle; }

#club-name-display { display:flex; align-items:center; gap:10px; }
.club-brand-logo { width:44px; height:44px; object-fit:contain; flex-shrink:0; }

.exam-copy-button { background:#ffdf00; color:#b91c1c; font-weight:700; padding:10px 22px; border:0; border-radius:6px; cursor:pointer; margin:0 12px 12px 0; }
.exam-copy-button:disabled { opacity:.5; cursor:default; }

.exam-official-actions { display:flex; align-items:center; gap:12px; margin-bottom:12px; }
.exam-official-actions > button { margin:0 !important; width:auto; }

.exam-official-actions > .exam-delete-all-button { margin-left:auto !important; }

#student-site-filter-buttons { display:flex; flex-wrap:wrap; gap:8px; flex-basis:100%; }
.student-site-filter-button { padding:9px 16px; border:1px solid #cbd5e1; border-radius:8px; background:#fff; color:#334155; cursor:pointer; font:inherit; }
.student-site-filter-button:hover { background:#f1f5f9; }
.student-site-filter-button[aria-pressed="true"] { background:#1e40af; border-color:#1e40af; color:#fff; font-weight:700; }
.student-site-filter-button:focus-visible { outline:3px solid #93c5fd; outline-offset:2px; }

body.staff-readonly.affiliate-entry #addStudentModal button[onclick="scanFace()"] { display:inline-block; }

body.staff-readonly.affiliate-entry #student-table-body td:last-child button { display:inline-block; }

body.staff-readonly.affiliate-entry #student-add-button { display:inline-block; }

body.staff-readonly.affiliate-entry #student-face-menu-card:not([hidden]) { display:inline-block; }

body.staff-readonly.affiliate-entry .attendance-face-button:not([hidden]) { display:flex; }
.attendance-face-button[hidden] { display:none; }

body.staff-readonly.scoped-entry #student-add-button { display:inline-block; }

.exam-temporary-site-filters { display:flex; flex-wrap:wrap; gap:8px; margin:0 0 16px; }
.exam-site-filter-button { padding:9px 16px; border:1px solid #b71c1c; border-radius:6px; background:#fff; color:#a61919; cursor:pointer; font:inherit; }
.exam-site-filter-button[aria-pressed="true"] { background:#b71c1c; color:#fff; font-weight:700; }
.exam-site-filter-button:focus-visible { outline:3px solid #f8b612; outline-offset:2px; }
.navbar-notification-item.is-unread { border-left:3px solid #b71c1c; padding-left:10px; }
.navbar-notification-item.is-read { background:#f8fafc; padding-left:10px; }
.navbar-notification-item p { white-space:pre-wrap; overflow-wrap:anywhere; }
.notification-mark-read { display:block; margin-top:8px; padding:6px 10px; border:1px solid #b71c1c; border-radius:5px; background:#fff; color:#a61919; cursor:pointer; }
.notification-read-status { display:block; margin-top:6px; color:#64748b; font-size:12px; }
/* Inventory statistics follows content widths and keeps numeric columns readable. */
#inventory-statistics-section .table-container { overflow:auto; max-width:100%; }
#inventory-statistics-section table { width:100%; min-width:0; table-layout:auto; }
#inventory-statistics-section th,
#inventory-statistics-section td { padding:10px 12px; vertical-align:middle; white-space:nowrap; }
#inventory-statistics-section th { text-transform:none; }
#inventory-statistics-section tr > :nth-child(1),
#inventory-statistics-section tr > :nth-child(4) { width:1%; text-align:center; }
#inventory-statistics-section tr > :nth-child(3) { min-width:140px; max-width:280px; white-space:normal; overflow-wrap:anywhere; }
#inventory-statistics-section tr > :nth-child(n+5) { text-align:right; font-variant-numeric:tabular-nums; }
#inventory-statistics-section tr > :nth-child(8) { font-weight:700; background:#fff9e8; }
#inventory-statistics-section input.inventory-opening-input { box-sizing:border-box; min-width:72px; max-width:170px; padding:7px 9px; text-align:right; font:inherit; font-variant-numeric:tabular-nums; border:1px solid var(--border-color); border-radius:5px; }
#inventory-statistics-search { max-width:100%; box-sizing:border-box; }
/* Import/export entry tables size columns to their content. */
:is(#inventory-exports-section,#inventory-imports-section) .table-container { max-width:100%; overflow-x:auto; }
:is(#inventory-exports-section,#inventory-imports-section) table { width:100%; min-width:760px; table-layout:auto; }
:is(#inventory-exports-section,#inventory-imports-section) th,
:is(#inventory-exports-section,#inventory-imports-section) td { padding:10px 12px; vertical-align:middle; }
:is(#inventory-exports-section,#inventory-imports-section) th { text-transform:none; white-space:nowrap; }
:is(#inventory-exports-section,#inventory-imports-section) tr > :first-child { width:38%; min-width:230px; }
:is(#inventory-exports-section,#inventory-imports-section) tr > :nth-child(2),
:is(#inventory-exports-section,#inventory-imports-section) tr > :nth-child(7) { width:1%; white-space:nowrap; text-align:center; }
:is(#inventory-exports-section,#inventory-imports-section) tr > :nth-child(n+3):nth-child(-n+6) { text-align:right; white-space:nowrap; font-variant-numeric:tabular-nums; }
:is(#inventory-exports-section,#inventory-imports-section) tr > :nth-child(6) { font-weight:700; }
:is(#inventory-exports-section,#inventory-imports-section) :is(.export-product,.import-product) { box-sizing:border-box; width:100%; min-width:210px; padding:9px; font:inherit; }
:is(#inventory-exports-section,#inventory-imports-section) :is(.export-quantity,.import-quantity,.export-discount,.import-discount) { box-sizing:border-box; padding:8px; text-align:right; font:inherit; border:1px solid var(--border-color); border-radius:5px; }
:is(#inventory-exports-section,#inventory-imports-section) :is(.export-quantity,.import-quantity) { width:100px !important; }
:is(#inventory-exports-section,#inventory-imports-section) :is(.export-discount,.import-discount) { width:85px !important; }
:is(#inventory-exports-section,#inventory-imports-section) :is(.export-price,.import-price) { display:inline-block; min-width:75px; white-space:nowrap; }
:is(#inventory-exports-section,#inventory-imports-section) .account-create-grid > label { min-width:0; }
:is(#inventory-exports-section,#inventory-imports-section) .account-create-grid input { box-sizing:border-box; width:100%; min-width:0; }
#navbar-settings-button[hidden], #accounts-create-section[hidden], #accounts-list-section[hidden] { display:none !important; }
.cash-notice-batch-controls { display:flex; flex-wrap:wrap; align-items:end; gap:10px; margin:14px 0; padding:14px; background:#fff9e8; border-radius:8px; }
.cash-notice-batch-controls[hidden] { display:none; }
.cash-notice-batch-controls label { display:flex; flex-direction:column; gap:6px; }
#cash-notice-interval { width:110px; padding:9px; font:inherit; border:1px solid var(--border-color); border-radius:5px; }
#cash-notice-batch-status { flex-basis:100%; margin:4px 0 0; font-size:14px; }
.cash-notice-batch-controls button:disabled { opacity:.55; cursor:not-allowed; }

.transfer-notice-batch-controls { display:flex; flex-wrap:wrap; align-items:end; gap:10px; margin:14px 0; padding:14px; background:#fff9e8; border-radius:8px; }
.transfer-notice-batch-controls[hidden] { display:none; }
.transfer-notice-batch-controls label { display:flex; flex-direction:column; gap:6px; }
#transfer-notice-interval { width:110px; padding:9px; font:inherit; border:1px solid var(--border-color); border-radius:5px; }
#transfer-notice-batch-status { flex-basis:100%; margin:4px 0 0; font-size:14px; }
.transfer-notice-batch-controls button:disabled { opacity:.55; cursor:not-allowed; }

/* Shared layout for desktop, tablet and phone. Wide data stays in its own scroller. */
html { -webkit-text-size-adjust:100%; scroll-padding-top:20px; }
.container { width:100%; min-width:0; }
.app-section > *, .form-section > *, .modal-body > *, .personal-info-layout > *,
.main-menu-grid > *, .personal-info-grid > *, .account-create-grid > * { min-width:0; }
.top-navbar { gap:16px; flex-wrap:wrap; }
#club-name-display { min-width:0; overflow-wrap:anywhere; }
.user-info { min-width:0; flex-wrap:wrap; }
.user-info > span { overflow-wrap:anywhere; }
.main-menu-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
.tuition-menu-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
.menu-card { min-width:0; overflow-wrap:anywhere; }
.action-header, .dashboard-header, .exam-official-actions { flex-wrap:wrap; }
.action-header h2, .dashboard-header h2 { overflow-wrap:anywhere; }
.personal-info-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
input, select, textarea { max-width:100%; }
textarea { resize:vertical; }
img, video, canvas { max-width:100%; }
.table-container, .responsive-table-scroll, .student-lookup-scroll,
.coach-attendance-scroll { width:100%; max-width:100%; min-width:0; overflow:auto; overscroll-behavior-x:contain; -webkit-overflow-scrolling:touch; }
.responsive-table-scroll { margin:12px 0; }
.table-scroll-hint { color:#64748b; font-size:13px; margin:6px 0; }
.table-scroll-hint[hidden] { display:none; }
.modal { padding:16px max(8px,env(safe-area-inset-right)) max(16px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left)); }
.modal-content { width:min(100%,1250px); margin:0 auto; }
.modal-header { gap:12px; }
.modal-header h3 { overflow-wrap:anywhere; }
.modal-footer { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:10px; }
.modal-footer button { margin:0; }
.face-camera-content { max-width:640px; }
#face-camera-video { width:100%; height:auto; max-height:50dvh; object-fit:contain; }
button, input, select, textarea, a { touch-action:manipulation; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline:3px solid #2563eb; outline-offset:3px;
}
body > .local-demo-banner { position:relative !important; z-index:auto !important; overflow-wrap:anywhere; }
[hidden] { display:none !important; }

@media (min-width:1600px) {
    .container { max-width:1480px; }
    .main-menu-grid { max-width:1180px; }
    .tuition-menu-grid { max-width:800px; }
}
@media (min-width:601px) and (max-width:1024px) {
    .container { margin:22px auto; padding:18px; }
    .top-navbar { padding:16px 20px; }
    .main-menu-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:18px; }
    .stats-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
    .personal-info-layout { flex-direction:column; align-items:stretch; }
    .personal-info-grid, #employee-form .personal-info-grid { width:100%; grid-template-columns:repeat(2,minmax(0,1fr)); }
    .personal-info-grid .span-3 { grid-column:1 / -1; }
    .schedule-grid-container { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .form-section { padding:20px; }
}
@media (max-width:1024px) {
    /* Frozen identifiers previously occupied most of a tablet/phone viewport. */
    :is(#attendance-section,#tuition-tracking-section,#tuition-receipts-section,#tuition-transfer-receipts-section,#coach-attendance-section) table tbody tr > :is(td,th) {
        position:static !important; left:auto !important; right:auto !important; box-shadow:none !important;
    }
    :is(#attendance-section,#tuition-tracking-section,#tuition-receipts-section,#tuition-transfer-receipts-section,#coach-attendance-section) table thead tr > th {
        left:auto !important; right:auto !important;
    }
    .face-id-group { flex-wrap:wrap; }
    .bank-url-controls > *, .receipt-date-filters > *, .zalo-template-fields > * { min-width:0; max-width:100%; }
}
@media (max-width:600px) {
    .container { margin:14px auto; padding:12px; }
    .top-navbar { padding:12px; gap:12px; }
    #club-name-display { flex-basis:100%; font-size:18px; gap:8px; }
    .club-brand-logo { width:36px; height:36px; }
    .user-info { width:100%; gap:8px; justify-content:flex-end; }
    .user-info > span { flex:1 1 100%; font-size:14px; }
    .navbar-notification-button { width:44px; height:44px; }
    .btn-logout { min-height:44px; }
    .navbar-notification-panel { position:fixed; top:auto; left:12px; right:12px; width:auto; margin-top:8px; max-height:60dvh; }
    .login-box { margin:24px auto; padding:26px 18px; }
    .menu-title { font-size:20px; margin-bottom:20px; }
    .main-menu-grid, .tuition-menu-grid, body.staff-readonly #main-menu-section .main-menu-grid {
        grid-template-columns:minmax(0,1fr); gap:12px;
    }
    .menu-card { padding:18px 16px; display:flex; align-items:center; gap:16px; text-align:left; min-height:78px; }
    .menu-card .icon { font-size:30px; margin:0; flex:0 0 38px; text-align:center; }
    .menu-card h3 { font-size:16px; line-height:1.45; }
    .stats-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; margin-bottom:18px; }
    .stat-card { padding:14px 8px; }
    .stat-card h3 { font-size:24px; }
    .action-header { gap:12px; margin-bottom:16px; }
    .action-header h2, .dashboard-header h2 { font-size:21px; line-height:1.4; }
    .dashboard-header { gap:12px; }
    .form-section { padding:16px; margin-bottom:16px; }
    .personal-info-layout { flex-direction:column; gap:18px; align-items:stretch; }
    .avatar-upload-box { align-self:center; }
    .personal-info-grid, #employee-form .personal-info-grid { width:100%; grid-template-columns:minmax(0,1fr); gap:14px; }
    .personal-info-grid :is(.span-2,.span-3) { grid-column:auto; }
    .schedule-grid-container, #employee-schedule-container { grid-template-columns:minmax(0,1fr); }
    .account-create-grid { align-items:stretch; }
    .account-create-grid label { flex:1 1 100%; }
    .form-section :is(input,select,textarea):not([type=checkbox]):not([type=radio]):not([type=hidden]),
    .modal :is(input,select,textarea):not([type=checkbox]):not([type=radio]):not([type=hidden]),
    .login-box input { font-size:16px; min-height:44px; }
    :is(.form-group-item,.account-create-grid label) :is(input,select,textarea) { width:100%; }
    .form-group-item input[type=checkbox], .form-group-item input[type=radio] { width:auto; }
    button:not(.toggle-switch), .btn-back, .btn-primary, .student-site-filter-button, .exam-site-filter-button { min-height:44px; }
    .toggle-switch input { min-height:0; }
    .modal { padding-top:8px; }
    .modal-content { border-radius:8px; }
    .modal-header, .modal-body, .modal-footer { padding:16px; }
    .modal-header { align-items:flex-start; }
    .modal-header .close { min-width:44px; min-height:44px; display:grid; place-items:center; }
    .modal-footer > button { flex:1 1 140px; }
    .table-container { padding:8px; }
    th, td { padding:10px 8px; }
    .attendance-search-toolbar { padding:12px; flex-direction:column; align-items:stretch; }
    .attendance-year-label, .attendance-search-label { max-width:100%; }
    .bank-url-controls, .receipt-date-filters, .cash-collection-fields, .zalo-template-fields { align-items:stretch; }
    .bank-url-controls > *, .receipt-date-filters > label, .cash-collection-fields > label,
    .zalo-template-fields > div, .zalo-template-fields > label { flex:1 1 100%; width:100%; }
    .receipt-date-filters input, .bank-url-controls input { width:100%; }
    .cash-notice-batch-controls, .transfer-notice-batch-controls { padding:12px; gap:8px; }
    .exam-official-actions { gap:8px; }
    .exam-official-actions > button { flex:1 1 140px; }
    .notification-container { top:12px; right:12px; left:12px; pointer-events:none; }
    .notification { width:100%; min-width:0; max-width:100%; overflow-wrap:anywhere; pointer-events:auto; }
    #clb-module-settings label { align-items:flex-start !important; line-height:1.5; }
    #clb-module-settings input[type=checkbox] { width:22px !important; height:22px; flex-shrink:0; }
}
@media (prefers-reduced-motion:reduce) {
    *, *::before, *::after { animation:none !important; transition:none !important; scroll-behavior:auto !important; }
}

.student-belt-preview { width:140px; text-align:center; color:#444; font-size:12px; line-height:1.4; }
.student-belt-preview svg { display:block; width:100%; height:auto; }
.student-belt-preview span { display:block; margin-top:2px; }
.student-belt-preview[hidden] { display:none; }
