/* ตั้งค่าพื้นฐาน */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background-color: #f4f6f9;
    color: #333;
}

/* ส่วนหัวเว็บไซต์ */

header {
    background-color: #1e3a5f;
    color: white;
    padding: 25px;
    text-align: center;
}

header h1 {
    margin: 0;
}

header p {
    margin-bottom: 0;
}

/* ส่วนเนื้อหา */

main {
    max-width: 1200px;
    margin: auto;
    padding: 30px 20px;
}

h2 {
    color: #1e3a5f;
}

/* ส่วนแสดงข้อมูลสรุป */

.summary {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    text-align: center;
}

.card h3 {
    font-size: 16px;
    color: #666;
}

.card p {
    font-size: 32px;
    font-weight: bold;
    color: #1e3a5f;
}

/* รายการห้องเรียน */

.room-list {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.room {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

.room h3 {
    color: #1e3a5f;
}

.room button {
    background: #2563eb;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
}

.room button:hover {
    background: #1d4ed8;
}
/* ============================= */
/* หน้าเข้าสู่ระบบ */
/* ============================= */

#login-panel {
    max-width: 400px;
    margin: 60px auto;
    background: white;
    padding: 35px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

#login-panel h2 {
    text-align: center;
    margin-top: 0;
}

#login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#login-form label {
    font-weight: bold;
}

#login-form input {
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 16px;
}

#login-form button {
    background-color: #2563eb;
    color: white;
    padding: 13px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 10px;
}

#login-form button:hover {
    background-color: #1d4ed8;
}

#login-message {
    color: #dc2626;
    text-align: center;
}

/* ============================= */
/* ส่วนบัญชีผู้ใช้ */
/* ============================= */

#account-info {
    margin-top: 20px;
}

#logout-btn {
    margin-left: 15px;
    padding: 8px 15px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

#data-status {
    color: #dc2626;
}

/* รักษาการซ่อนองค์ประกอบที่ยังไม่ใช้งาน */
[hidden] {
    display: none !important;
}

/* ================================= */
/* หน้ารายละเอียดห้องเรียน */
/* ================================= */

#back-dashboard {
    background-color: #64748b;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 25px;
}

#back-dashboard:hover {
    background-color: #475569;
}

/* การ์ดชุดคอมพิวเตอร์ */

.computer-set {
    background-color: white;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

.computer-set h3 {
    color: #1e3a5f;
    margin-top: 0;
}

/* ตารางอุปกรณ์ */

.table-scroll {
    width: 100%;
    overflow-x: auto;
}

.equipment-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.equipment-table th {
    background-color: #1e3a5f;
    color: white;
    padding: 12px;
    text-align: left;
}

.equipment-table td {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
}

.equipment-table tr:hover {
    background-color: #f8fafc;
}

/* สถานะอุปกรณ์ */

.status-normal {
    color: #16a34a;
    font-weight: bold;
}

.status-damaged {
    color: #dc2626;
    font-weight: bold;
}

.status-repair {
    color: #d97706;
    font-weight: bold;
}

.status-retired {
    color: #64748b;
    font-weight: bold;
}

#room-status {
    color: #475569;
}

/* ================================= */
/* หน้ารายละเอียดครุภัณฑ์ */
/* ================================= */

#back-room {
    background-color: #64748b;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 25px;
}

#back-room:hover {
    background-color: #475569;
}

/* รายการรายละเอียด */

.detail-list {
    width: 100%;
}

.detail-row {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 15px;
    padding: 14px 0;
    border-bottom: 1px solid #e5e7eb;
}

.detail-row strong {
    color: #475569;
}

.detail-row span {
    overflow-wrap: anywhere;
}

/* ประวัติการซ่อม */

.repair-card {
    background-color: #f8fafc;
    border: 1px solid #e5e7eb;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 15px;
}

.repair-card h4 {
    color: #1e3a5f;
    margin-top: 0;
}

/* ปรับสำหรับโทรศัพท์ */

@media (max-width: 600px) {

    .detail-row {
        grid-template-columns: 1fr;
        gap: 5px;
    }

}

/* ================================= */
/* ฟอร์มเพิ่มครุภัณฑ์ */
/* ================================= */

#new-equipment-form {
    background: white;
    max-width: 700px;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);

    display: flex;
    flex-direction: column;
    gap: 12px;
}

#new-equipment-form label {
    font-weight: bold;
    color: #334155;
    margin-top: 8px;
}

#new-equipment-form input,
#new-equipment-form select,
#new-equipment-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 16px;
    box-sizing: border-box;
}

#new-equipment-form input:focus,
#new-equipment-form select:focus {
    outline: 2px solid #2563eb;
    border-color: #2563eb;
}

#add-equipment-btn,
#new-equipment-form button[type="submit"] {
    background: #2563eb;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

#add-equipment-btn {
    margin-bottom: 20px;
}

#add-equipment-btn:hover,
#new-equipment-form button[type="submit"]:hover {
    background: #1d4ed8;
}

#new-equipment-form button:disabled {
    opacity: 0.6;
    cursor: wait;
}

#cancel-add-equipment {
    background: #64748b;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 20px;
}

#add-equipment-message {
    color: #dc2626;
}

/* ================================= */
/* ระบบเพิ่มชุดคอมพิวเตอร์ */
/* ================================= */

#add-set-btn {
    background: #059669;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin: 0 0 20px 10px;
}

#add-set-btn:hover {
    background: #047857;
}

#add-set-panel {
    background: white;
    max-width: 650px;
    padding: 25px;
    margin-bottom: 25px;
    border-radius: 12px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

#new-set-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#new-set-form label {
    font-weight: bold;
    color: #334155;
}

#new-set-form input,
#new-set-form select,
#new-set-form textarea {
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 16px;
    width: 100%;
    box-sizing: border-box;
}

.set-form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.set-form-actions button {
    padding: 12px 18px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.set-form-actions button[type="submit"] {
    background: #059669;
    color: white;
}

#set-message {
    color: #dc2626;
}

/* ================================= */
/* ฟอร์มข้อมูลสเปคคอมพิวเตอร์ */
/* ================================= */

#computer-spec-fields {
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 25px;
    margin-top: 20px;
    background-color: #f8fafc;
}

#computer-spec-fields legend {
    font-size: 20px;
    font-weight: bold;
    color: #1e3a5f;
    padding: 0 10px;
}

.spec-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.spec-grid label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #334155;
}

.spec-grid input,
.spec-grid select {
    width: 100%;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 16px;
    box-sizing: border-box;
}

/* โทรศัพท์มือถือ */

@media (max-width: 600px) {

    .spec-grid {
        grid-template-columns: 1fr;
    }

}

/* ================================= */
/* หน้าแก้ไขครุภัณฑ์ */
/* ================================= */

#edit-equipment-btn {
    background: #f59e0b;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 20px;
}

#cancel-edit-btn {
    background: #64748b;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 20px;
}

#edit-equipment-form {
    background: white;
    max-width: 750px;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);

    display: flex;
    flex-direction: column;
    gap: 12px;
}

#edit-equipment-form label {
    font-weight: bold;
    color: #334155;
    margin-top: 8px;
}

#edit-equipment-form input,
#edit-equipment-form select,
#edit-equipment-form textarea {
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 16px;
    width: 100%;
    box-sizing: border-box;
}

#edit-computer-specs {
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
}

#edit-computer-specs legend {
    font-size: 18px;
    font-weight: bold;
    color: #1e3a5f;
}

#save-edit-btn {
    background: #16a34a;
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 20px;
}

#save-edit-btn:hover {
    background: #15803d;
}

#save-edit-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

#edit-message {
    color: #dc2626;
}

/* รักษาการซ่อนส่วนที่ยังไม่ใช้งาน */
[hidden] {
    display: none !important;
}

/* ================================= */
/* ระบบลบและกู้คืนครุภัณฑ์ */
/* ================================= */

#delete-equipment-btn {
    background: #dc2626;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 20px;
}

#delete-equipment-btn:hover {
    background: #b91c1c;
}

#delete-equipment-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

#show-deleted-btn {
    background: #64748b;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin: 0 0 20px 10px;
}

#deleted-panel {
    background: white;
    padding: 25px;
    border-radius: 12px;
    margin: 20px 0;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

.deleted-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border-bottom: 1px solid #e5e7eb;
}

.restore-btn {
    background: #16a34a;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.restore-btn:hover {
    background: #15803d;
}

.restore-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

@media (max-width: 600px) {
    .deleted-item {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ================================= */
/* หน้ารายการครุภัณฑ์ที่ลบแล้ว */
/* ================================= */

#deleted-panel {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
    background: transparent;
    box-shadow: none;
}

#back-from-deleted {
    background: #64748b;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 25px;
}

#back-from-deleted:hover {
    background: #475569;
}

#deleted-room-title {
    color: #64748b;
    font-size: 18px;
    margin-bottom: 25px;
}

#deleted-equipment-list {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

/* ================================= */
/* ระบบแจ้งซ่อมครุภัณฑ์ */
/* ================================= */

#report-repair-btn {
    background: #ea580c;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 20px;
}

#report-repair-btn:hover {
    background: #c2410c;
}

/* ปุ่มกลับ */

#back-from-repair {
    background: #64748b;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 25px;
}

/* การ์ดฟอร์ม */

.repair-form-card {
    background: white;
    max-width: 750px;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

/* ชื่ออุปกรณ์ */

#repair-equipment-name {
    color: #1e3a5f;
    font-size: 20px;
    font-weight: bold;
}

/* ฟอร์มแจ้งซ่อม */

#repair-report-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 25px;
}

#repair-report-form label {
    font-weight: bold;
    color: #334155;
}

#repair-problem {
    width: 100%;
    padding: 15px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 16px;
    resize: vertical;
    box-sizing: border-box;
}

/* ปุ่มส่งแจ้งซ่อม */

#submit-repair-btn {
    background: #ea580c;
    color: white;
    padding: 14px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

#submit-repair-btn:hover {
    background: #c2410c;
}

#submit-repair-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* ข้อความสถานะ */

#repair-message {
    color: #dc2626;
}

/* ซ่อนองค์ประกอบเมื่อกำหนด hidden */

[hidden] {
    display: none !important;
}

/* ================================= */
/* ระบบจัดการงานซ่อม Admin */
/* ================================= */

#manage-repairs-btn {
    background: #2563eb;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 25px;
}

#back-from-repair-admin {
    background: #64748b;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 25px;
}

/* การ์ดงานซ่อม */

.repair-admin-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

.repair-admin-card h3 {
    margin-top: 0;
    color: #1e3a5f;
}

.repair-admin-card p {
    line-height: 1.8;
}

/* ช่องกรอกข้อมูล */

.repair-admin-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 15px;
}

.repair-admin-field label {
    font-weight: bold;
}

.repair-admin-field input,
.repair-admin-field textarea {
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 16px;
    width: 100%;
    box-sizing: border-box;
}

/* ปุ่มเปลี่ยนสถานะ */

.repair-action-btn {
    background: #2563eb;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 20px;
}

.repair-action-btn:hover {
    background: #1d4ed8;
}

.repair-action-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

#repair-admin-status {
    color: #475569;
}

/* ป้องกันหน้าเว็บซ้อนกัน */

[hidden] {
    display: none !important;
}

/* ================================= */
/* ระบบกรองงานซ่อมตามห้องเรียน */
/* ================================= */

.repair-filter {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin: 20px 0;
    max-width: 500px;
}

.repair-filter label {
    display: block;
    font-weight: bold;
    margin-bottom: 10px;
    color: #1e3a5f;
}

.repair-filter select {
    width: 100%;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 16px;
}

/* ระบบแบ่งหน้า */

.repair-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    margin: 25px 0;
}

.repair-pagination button {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    background: #1e3a5f;
    color: white;
    cursor: pointer;
}

.repair-pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* หน้าประวัติการซ่อม */

.history-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 15px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

.history-card h3 {
    color: #1e3a5f;
    margin-top: 0;
}

.history-card p {
    line-height: 1.7;
    overflow-wrap: anywhere;
}

#open-repair-history,
#back-from-history {
    background: #64748b;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    cursor: pointer;
    margin-bottom: 15px;
}

#history-scope {
    color: #475569;
}

[hidden] {
    display: none !important;
}

/* ================================= */
/* ระบบย้ายครุภัณฑ์ */
/* ================================= */

#move-equipment-btn {
    background: #0891b2;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    cursor: pointer;
    margin-bottom: 20px;
}

#cancel-move-btn {
    background: #64748b;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    cursor: pointer;
    margin-bottom: 20px;
}

#move-equipment-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 700px;
}

#move-equipment-form label {
    font-weight: bold;
    color: #334155;
}

#move-equipment-form select,
#move-equipment-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 16px;
    box-sizing: border-box;
}

#save-move-btn {
    background: #16a34a;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 14px 20px;
    cursor: pointer;
}

#save-move-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

#move-message {
    color: #dc2626;
}

.movement-card {
    border-bottom: 1px solid #e5e7eb;
    padding: 15px 0;
}

.movement-card:last-child {
    border-bottom: none;
}

.movement-card p {
    margin: 8px 0;
    overflow-wrap: anywhere;
}

[hidden] {
    display: none !important;
}

/* ================================= */
/* หน้าค้นหาครุภัณฑ์ */
/* ================================= */

#open-equipment-search {
    background: #2563eb;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 20px;
}

#back-from-equipment-search {
    background: #64748b;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 20px;
}

/* ฟอร์มค้นหา */

#equipment-search-form {
    background: white;
    padding: 25px;
    border-radius: 12px;
    margin: 25px 0;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

.equipment-search-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.equipment-search-grid label {
    display: block;
    font-weight: bold;
    margin-bottom: 8px;
}

.equipment-search-grid input,
.equipment-search-grid select {
    width: 100%;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 16px;
    box-sizing: border-box;
}

#search-submit-btn {
    background: #16a34a;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    cursor: pointer;
}

/* ผลการค้นหา */

.equipment-search-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 15px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

.equipment-search-card h3 {
    margin-top: 0;
    color: #1e3a5f;
}

.equipment-search-card p {
    margin: 8px 0;
}

.equipment-search-card button {
    margin-top: 12px;
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    background: #2563eb;
    color: white;
    cursor: pointer;
}

#equipment-search-status {
    color: #475569;
}

@media (max-width: 600px) {

    .equipment-search-grid {
        grid-template-columns: 1fr;
    }

}

[hidden] {
    display: none !important;
}

/* ===================================== */
/* หน้ารายการครุภัณฑ์ทั้งหมด */
/* ===================================== */

/* การ์ดสรุป */

.inventory-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 15px;
    margin: 25px 0;
}

.inventory-summary-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.inventory-summary-card span {
    display: block;
    font-size: 15px;
    color: #64748b;
    margin-bottom: 15px;
}

.inventory-summary-card strong {
    display: block;
    font-size: 30px;
    color: #1e3a5f;
}

.inventory-summary-card:hover {
    border-color: #2563eb;
    background: #f8fafc;
}


/* ===================================== */
/* ช่องค้นหาและตัวกรอง */
/* ===================================== */

#equipment-search-form {
    background: white;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

#equipment-search-form h3 {
    margin-top: 0;
    color: #1e3a5f;
}

.inventory-keyword {
    margin-bottom: 20px;
}

.inventory-keyword label,
.inventory-filters label {
    display: block;
    font-weight: bold;
    margin-bottom: 8px;
    color: #334155;
}

.inventory-keyword input {
    width: 100%;
    padding: 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 16px;
    box-sizing: border-box;
}

.inventory-filters {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 15px;
}

.inventory-filters select {
    width: 100%;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 16px;
    box-sizing: border-box;
}

.inventory-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

#equipment-search-reset {
    background: #e2e8f0;
    color: #334155;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}


/* ===================================== */
/* ตารางรายการครุภัณฑ์ */
/* ===================================== */

.inventory-table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.inventory-table-header h3 {
    margin: 0;
    color: #1e3a5f;
}

.inventory-table-scroll {
    width: 100%;
    overflow-x: auto;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.inventory-table {
    width: 100%;
    min-width: 1050px;
    border-collapse: collapse;
    font-size: 14px;
}

.inventory-table thead {
    background: #1e3a5f;
    color: white;
}

.inventory-table th {
    padding: 16px 14px;
    text-align: left;
    font-weight: bold;
    white-space: nowrap;
}

.inventory-table td {
    padding: 14px;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: middle;
}

.inventory-table tbody tr:nth-child(even) {
    background: #f8fafc;
}

.inventory-table tbody tr:hover {
    background: #eff6ff;
}

.inventory-table td:nth-child(1) {
    font-weight: bold;
    color: #334155;
}

.inventory-table td:nth-child(2) {
    min-width: 170px;
}

.inventory-table td:nth-child(5),
.inventory-table td:nth-child(6) {
    text-align: center;
}

.inventory-table td:nth-child(7) {
    white-space: nowrap;
}

.inventory-detail-btn {
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 7px;
    padding: 9px 12px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}

.inventory-detail-btn:hover {
    background: #1d4ed8;
}

.inventory-detail-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

.inventory-empty {
    text-align: center;
    padding: 35px !important;
    color: #64748b;
}


/* ===================================== */
/* สถานะอุปกรณ์ */
/* ===================================== */

.inventory-status {
    font-weight: bold;
}

.inventory-status.normal {
    color: #16a34a;
}

.inventory-status.damaged {
    color: #dc2626;
}

.inventory-status.in_repair {
    color: #d97706;
}

.inventory-status.retired {
    color: #64748b;
}


/* ===================================== */
/* รองรับโทรศัพท์มือถือ */
/* ===================================== */

@media (max-width: 900px) {

    .inventory-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .inventory-filters {
        grid-template-columns: 1fr;
    }

}

@media (max-width: 480px) {

    .inventory-summary-card {
        padding: 15px 10px;
    }

    .inventory-summary-card strong {
        font-size: 25px;
    }

    .inventory-actions {
        flex-wrap: wrap;
    }

}

/* ========================================= */
/* Compact Search Bar - แถบค้นหาแนวนอน -------------------------------------*/
/* ========================================= */

/* กล่องค้นหาหลัก */

#equipment-search-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;

    gap: 12px;

    padding: 18px 20px;
    margin-bottom: 20px;

    background: white;
    border-radius: 12px;
}


/* หัวข้อค้นหา */

#equipment-search-form h3 {
    flex: 0 0 100%;
    margin: 0 0 5px 0;
    font-size: 17px;
}


/* ช่องค้นหา */

.inventory-keyword {
    flex: 2 1 250px;
    min-width: 190px;
    margin: 0;
}

.inventory-keyword input {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    box-sizing: border-box;
}


/* ทำให้ตัวกรองทั้ง 3 ช่องเรียงแนวนอน */

.inventory-filters {
    display: contents;
}

.inventory-filters > div {
    flex: 1 1 125px;
    min-width: 105px;
}

.inventory-filters select {
    width: 100%;
    height: 44px;
    padding: 0 10px;
    box-sizing: border-box;
}


/* ปรับข้อความกำกับช่อง */

.inventory-keyword label,
.inventory-filters label {
    display: block;

    font-size: 13px;
    font-weight: 600;

    margin-bottom: 6px;

    color: #475569;
}


/* ปุ่มค้นหาและล้างตัวกรอง */

.inventory-actions {
    display: flex;
    flex: 0 0 auto;

    gap: 8px;
    margin: 0;
}

#search-submit-btn,
#equipment-search-reset {
    height: 44px;

    padding: 0 15px;

    border: none;
    border-radius: 8px;

    font-size: 14px;
    white-space: nowrap;
    cursor: pointer;
}


/* ========================================= */
/* รองรับหน้าจอขนาดเล็ก */
/* ========================================= */

@media (max-width: 700px) {

    .inventory-keyword {
        flex: 1 1 100%;
    }

    .inventory-filters > div {
        flex: 1 1 150px;
    }

    .inventory-actions {
        flex: 1 1 100%;
    }

    #search-submit-btn,
    #equipment-search-reset {
        flex: 1;
    }

}
/* Compact Search Bar - แถบค้นหาแนวนอน -------------------------------------*/


/* ===================================== */
/* ปุ่มเปลี่ยนมุมมอง */
/* ===================================== */

.inventory-view-switch {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.inventory-view-switch button {
    padding: 12px 20px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: white;
    color: #334155;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.inventory-view-switch button[aria-pressed="true"] {
    background: #1e3a5f;
    border-color: #1e3a5f;
    color: white;
}


/* ===================================== */
/* มุมมองชุดคอมพิวเตอร์ */
/* ===================================== */

.set-view-toolbar {
    background: white;
    padding: 18px 20px;
    border-radius: 12px;
    margin-bottom: 20px;

    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 15px;
    flex-wrap: wrap;
}

.set-view-toolbar label {
    display: block;
    font-weight: bold;
    margin-bottom: 8px;
}

#set-view-room {
    min-width: 220px;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 16px;
}

#set-view-status {
    color: #475569;
    margin: 0;
}


/* การ์ดชุดคอมพิวเตอร์ */

.inventory-set-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 12px;
    overflow: hidden;
}

.inventory-set-card summary {
    padding: 20px;
    cursor: pointer;
    color: #1e3a5f;
    font-size: 16px;
}

.inventory-set-card summary:hover {
    background: #f1f5f9;
}

.inventory-set-card[open] summary {
    border-bottom: 1px solid #e2e8f0;
}

.inventory-set-content {
    padding: 15px;
}

.inventory-set-content .inventory-table {
    min-width: 650px;
}

.inventory-set-content .inventory-table td {
    padding: 12px;
}


/* โทรศัพท์มือถือ */

@media (max-width: 600px) {

    .inventory-view-switch button {
        flex: 1 1 100%;
    }

    #set-view-room {
        width: 100%;
        min-width: 0;
    }

    .set-view-toolbar {
        align-items: stretch;
    }

}

/* ===================================== */
/* ระบบจัดการชุดคอมพิวเตอร์ */
/* ===================================== */

#manage-sets-btn {
    background: #475569;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    cursor: pointer;
    margin-bottom: 20px;
}

#back-from-manage-sets {
    background: #64748b;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    cursor: pointer;
    margin-bottom: 20px;
}

.set-manager-toolbar {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    margin: 20px 0;
}

.set-manager-toolbar label {
    font-weight: bold;
}

.set-manager-toolbar select {
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 16px;
}

.set-manager-action {
    padding: 9px 12px;
    border: none;
    border-radius: 7px;
    color: white;
    cursor: pointer;
    margin: 3px;
}

.set-manager-edit {
    background: #2563eb;
}

.set-manager-archive {
    background: #dc2626;
}

.set-manager-restore {
    background: #16a34a;
}

#edit-set-panel {
    background: white;
    max-width: 700px;
    padding: 25px;
    margin: 25px 0;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

#edit-set-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#edit-set-form label {
    font-weight: bold;
}

#edit-set-form input,
#edit-set-form select,
#edit-set-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 16px;
    box-sizing: border-box;
}

.set-manager-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.set-manager-actions button {
    padding: 12px 18px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

#save-edit-set-btn {
    background: #16a34a;
    color: white;
}

#cancel-edit-set-btn {
    background: #e2e8f0;
    color: #334155;
}

#manage-sets-status {
    color: #475569;
}

#edit-set-message {
    color: #dc2626;
}

[hidden] {
    display: none !important;
}

/* ===================================== */
/* Dashboard Reports */
/* ===================================== */

#dashboard-reports {
    margin-top: 35px;
    padding-bottom: 40px;
}


/* ส่วนหัวรายงาน */

.report-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.report-heading h2 {
    color: #1e3a5f;
    margin: 0 0 8px;
}

.report-heading p {
    margin: 0;
    color: #64748b;
}

#refresh-dashboard-reports {
    background: #1e3a5f;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 18px;
    cursor: pointer;
}

#dashboard-report-status {
    color: #64748b;
    margin-bottom: 15px;
}


/* ===================================== */
/* การ์ดข้อมูลเพิ่มเติม */
/* ===================================== */

.report-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.report-metric-card {
    background: white;
    padding: 22px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.report-metric-card span {
    display: block;
    font-size: 14px;
    color: #64748b;
    margin-bottom: 14px;
}

.report-metric-card strong {
    display: block;
    font-size: 30px;
    color: #1e3a5f;
}


/* ===================================== */
/* การ์ดกราฟและตาราง */
/* ===================================== */

.report-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.report-card h3 {
    color: #1e3a5f;
    margin-top: 0;
}


/* ===================================== */
/* กราฟสถานะครุภัณฑ์ */
/* ===================================== */

.report-chart {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 25px;
}

.report-chart-row {
    display: grid;
    grid-template-columns: 100px minmax(0, 1fr) 55px;
    align-items: center;
    gap: 15px;
}

.report-chart-row span {
    color: #475569;
    font-weight: 600;
}

.report-chart-row strong {
    text-align: right;
    color: #1e3a5f;
}

.report-chart-track {
    height: 22px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
}

.report-chart-fill {
    height: 100%;
    width: 0;
    border-radius: 6px;
    transition: width 0.4s ease;
}

.report-chart-fill.normal {
    background: #16a34a;
}

.report-chart-fill.damaged {
    background: #dc2626;
}

.report-chart-fill.repairing {
    background: #f59e0b;
}

.report-chart-fill.retired {
    background: #64748b;
}


/* ===================================== */
/* ตารางรายงานแยกตามห้อง */
/* ===================================== */

.report-table-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.report-table-heading h3 {
    margin: 0;
}

#export-room-report {
    background: #16a34a;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 18px;
    cursor: pointer;
}

.report-table-scroll {
    width: 100%;
    overflow-x: auto;
}

.report-table {
    width: 100%;
    min-width: 1050px;
    border-collapse: collapse;
    font-size: 14px;
}

.report-table th {
    background: #1e3a5f;
    color: white;
    padding: 14px;
    text-align: center;
    white-space: nowrap;
}

.report-table td {
    padding: 14px;
    border-bottom: 1px solid #e2e8f0;
    text-align: center;
}

.report-table tbody tr:nth-child(even) {
    background: #f8fafc;
}

.report-table tbody tr:hover {
    background: #eff6ff;
}


/* ===================================== */
/* รองรับหน้าจอขนาดเล็ก */
/* ===================================== */

@media (max-width: 900px) {

    .report-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

}

@media (max-width: 600px) {

    .report-card {
        padding: 16px;
    }

    .report-chart-row {
        grid-template-columns: 75px minmax(0, 1fr) 40px;
        gap: 8px;
        font-size: 13px;
    }

    .report-metric-card {
        padding: 15px 10px;
    }

    .report-metric-card strong {
        font-size: 25px;
    }

}
/* ===================================== */
/* ปุ่มส่งออกรายงานครุภัณฑ์ */
/* ===================================== */

.inventory-export-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    margin: 15px 0;
}

.inventory-export-actions button {
    padding: 11px 18px;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

#export-filtered-equipment {
    background: #2563eb;
}

#export-all-equipment {
    background: #16a34a;
}

.inventory-export-actions button:disabled {
    opacity: 0.5;
    cursor: wait;
}

#equipment-export-status {
    color: #475569;
    font-size: 14px;
}

@media (max-width: 600px) {

    .inventory-export-actions {
        justify-content: stretch;
    }

    .inventory-export-actions button {
        flex: 1 1 100%;
    }

}

/* ================================= */
/* ระบบส่งออกรายงาน */
/* ================================= */

.inventory-export-panel {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 15px;
    flex-wrap: wrap;

    background: white;
    padding: 16px 20px;
    margin: 15px 0;

    border: 1px solid #e2e8f0;
    border-radius: 12px;
}

.inventory-export-select label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #334155;
}

#equipment-export-scope {
    padding: 11px 12px;
    min-width: 230px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
}

.inventory-export-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.inventory-export-buttons button {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
}

#export-equipment-xlsx {
    background: #16a34a;
}

#print-equipment-report {
    background: #1e3a5f;
}

.inventory-export-buttons button:disabled {
    opacity: 0.5;
    cursor: wait;
}

#equipment-export-status {
    color: #475569;
    font-size: 14px;
}

@media (max-width: 600px) {
    .inventory-export-panel {
        align-items: stretch;
    }

    #equipment-export-scope {
        width: 100%;
    }

    .inventory-export-buttons button {
        flex: 1;
    }
}


/* ================================= */
/* เอกสารสำหรับพิมพ์ */
/* ================================= */

/* ปกติซ่อนรายงานพิมพ์ไว้ */
#inventory-print-root {
    display: none;
}

@page {
    size: A4 landscape;
    margin: 10mm;
}

@media print {

    /* ซ่อนเว็บไซต์ เหลือเฉพาะรายงาน */
    body > :not(#inventory-print-root) {
        display: none !important;
    }

    body {
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
    }

    #inventory-print-root {
        display: block !important;
        color: black;
        background: white;
        font-family: "TH Sarabun New", "Sarabun",
                     Tahoma, sans-serif;
    }

    .print-report-title {
        text-align: center;
        font-size: 20pt;
        font-weight: bold;
        margin: 0;
    }

    .print-report-department {
        text-align: center;
        font-size: 16pt;
        font-weight: bold;
        margin: 2mm 0 5mm;
    }

    .print-report-info {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 2mm 8mm;
        margin-bottom: 5mm;
        font-size: 11pt;
    }

    .print-report-table {
        width: 100%;
        table-layout: fixed;
        border-collapse: collapse;
        font-size: 9.5pt;
    }

    .print-report-table th,
    .print-report-table td {
        border: 1px solid #888;
        padding: 4px 5px;
        vertical-align: middle;
        overflow-wrap: anywhere;
    }

    .print-report-table th {
        background: #e8edf4 !important;
        font-weight: bold;
        text-align: center;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* แสดงหัวตารางซ้ำเมื่อขึ้นหน้าใหม่ */
    .print-report-table thead {
        display: table-header-group;
    }

    .print-report-table tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .print-report-table th:nth-child(1) {
        width: 5%;
    }

    .print-report-table th:nth-child(2) {
        width: 14%;
    }

    .print-report-table th:nth-child(3) {
        width: 15%;
    }

    .print-report-table th:nth-child(4) {
        width: 10%;
    }

    .print-report-table th:nth-child(5) {
        width: 12%;
    }

    .print-report-table th:nth-child(6) {
        width: 15%;
    }

    .print-report-table th:nth-child(7) {
        width: 7%;
    }

    .print-report-table th:nth-child(8) {
        width: 12%;
    }

    .print-report-table th:nth-child(9) {
        width: 10%;
    }

    .print-report-footer {
        margin-top: 5mm;
        font-size: 11pt;
        font-weight: bold;
    }

}

/* ===================================== */
/* รูปแบบเอกสาร PDF */
/* ===================================== */

#inventory-print-root.pdf-export {
    display: block !important;

    width: 270mm;
    box-sizing: border-box;

    background: white;
    color: #111827;

    font-family: "Sarabun", sans-serif;

    padding: 0;
    margin: 0;
}


/* หัวข้อรายงาน */

.pdf-export .print-report-title {
    font-size: 20pt;
    font-weight: 700;
    text-align: center;
    margin: 0;
}

.pdf-export .print-report-department {
    font-size: 16pt;
    font-weight: 700;
    text-align: center;
    margin: 2mm 0 6mm;
}


/* รายละเอียดตัวกรอง */

.pdf-export .print-report-info {
    display: grid;
    grid-template-columns: 1fr 1fr;

    gap: 2mm 8mm;

    font-size: 11pt;
    margin-bottom: 6mm;
}


/* ตาราง PDF */

.pdf-export .print-report-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;

    font-size: 9pt;
}

.pdf-export .print-report-table th,
.pdf-export .print-report-table td {
    border: 1px solid #94a3b8;

    padding: 5px 4px;

    vertical-align: middle;
    overflow-wrap: anywhere;
}

.pdf-export .print-report-table th {
    background: #e8edf4;
    font-weight: 700;
    text-align: center;
}


/* กำหนดความกว้างแต่ละคอลัมน์ */

.pdf-export .print-report-table th:nth-child(1) {
    width: 5%;
}

.pdf-export .print-report-table th:nth-child(2) {
    width: 14%;
}

.pdf-export .print-report-table th:nth-child(3) {
    width: 15%;
}

.pdf-export .print-report-table th:nth-child(4) {
    width: 10%;
}

.pdf-export .print-report-table th:nth-child(5) {
    width: 12%;
}

.pdf-export .print-report-table th:nth-child(6) {
    width: 15%;
}

.pdf-export .print-report-table th:nth-child(7) {
    width: 7%;
}

.pdf-export .print-report-table th:nth-child(8) {
    width: 12%;
}

.pdf-export .print-report-table th:nth-child(9) {
    width: 10%;
}


/* ป้องกันการตัดแถวกลางหน้า */

.pdf-export .print-report-table tr {
    break-inside: avoid;
    page-break-inside: avoid;
}


/* สรุปจำนวนท้ายรายงาน */

.pdf-export .print-report-footer {
    margin-top: 6mm;

    font-size: 11pt;
    font-weight: 700;

    text-align: right;
}

/* ===================================== */
/* ปุ่มบันทึก PDF */
/* ===================================== */

#save-equipment-pdf {
    background-color: #1e3a5f;
    color: white;

    border: none;
    border-radius: 8px;

    padding: 12px 20px;

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;
}

#save-equipment-pdf:hover:not(:disabled) {
    background-color: #2d527e;
}

/* ปุ่มสีเทาเฉพาะตอนกำลังทำงาน */

#save-equipment-pdf:disabled {
    background-color: #94a3b8;
    color: white;
    cursor: wait;
}


/* ===================================== */
/* แสดงพื้นที่รายงานสำหรับ PDF */
/* ===================================== */

#inventory-print-root.pdf-export {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;

    background: #ffffff;
    color: #000000;
}

/* ===================================== */
/* แก้ไข PDF หน้าว่าง */
/* ===================================== */

#inventory-print-root.pdf-export {
    display: block !important;
    position: static !important;

    width: 270mm;
    height: auto;

    visibility: visible !important;
    opacity: 1 !important;

    background: #ffffff !important;
    color: #000000;
}

/* ให้ตารางแสดงครบ */

#inventory-print-root.pdf-export table {
    display: table;
    width: 100%;
    border-collapse: collapse;
}

#inventory-print-root.pdf-export thead {
    display: table-header-group;
}

#inventory-print-root.pdf-export tbody {
    display: table-row-group;
}

#inventory-print-root.pdf-export tr {
    display: table-row;
}

/* ===================================== */
/* USER MANAGEMENT */
/* ===================================== */

#user-management-page {
    padding-bottom: 40px;
}

#user-management-page h2 {
    color: #1e3a5f;
}

#back-from-user-management {
    background: #64748b;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 18px;
    cursor: pointer;
}

#user-management-status {
    margin: 20px 0;
    color: #475569;
}


/* ตารางผู้ใช้งาน */

.user-management-table-wrap {
    overflow-x: auto;
    background: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.user-management-table {
    width: 100%;
    min-width: 850px;
    border-collapse: collapse;
}

.user-management-table th {
    background: #1e3a5f;
    color: white;
    padding: 16px;
    text-align: left;
}

.user-management-table td {
    padding: 15px;
    border-bottom: 1px solid #e2e8f0;
}

.user-management-table tbody tr:nth-child(even) {
    background: #f8fafc;
}

.user-management-table select {
    width: 100%;
    min-width: 170px;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
}


/* ปุ่มบันทึก */

.user-role-save {
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 15px;
    cursor: pointer;
    white-space: nowrap;
}

.user-role-save:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}


/* ป้ายแสดงบทบาท */

.user-role-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: bold;
}

.user-role-badge.admin {
    background: #fee2e2;
    color: #991b1b;
}

.user-role-badge.staff {
    background: #dbeafe;
    color: #1d4ed8;
}

.user-role-badge.viewer {
    background: #dcfce7;
    color: #166534;
}


/* ปุ่มแบ่งหน้า */

.user-management-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 25px;
}

.user-management-pagination button {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    background: #1e3a5f;
    color: white;
    cursor: pointer;
}

.user-management-pagination button:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
}

/* ===================================== */
/* ปุ่มจัดการผู้ใช้งานบน Dashboard */
/* ===================================== */

#open-user-management {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    background-color: #2563eb;
    color: #ffffff;

    border: none;
    border-radius: 10px;

    padding: 14px 22px;

    font-size: 15px;
    font-weight: 600;
    font-family: inherit;

    min-height: 55px;
    margin: 5px 4px;

    cursor: pointer;

    transition:
        background-color 0.2s,
        transform 0.2s;
}

/* เมื่อเลื่อนเมาส์ */

#open-user-management:hover {
    background-color: #1d4ed8;
    transform: translateY(-2px);
}

/* เมื่อกดปุ่ม */

#open-user-management:active {
    transform: translateY(0);
}

/* สำหรับการใช้คีย์บอร์ด */

#open-user-management:focus-visible {
    outline: 3px solid #93c5fd;
    outline-offset: 3px;
}

/* ปุ่มที่ซ่อนต้องไม่แสดง */

#open-user-management[hidden] {
    display: none !important;
}

/* ===================================== */
/* DASHBOARD ROOM GRID */
/* ===================================== */

/* จัดรายการห้องเรียนเป็น Grid */

#room-list {

    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 20px;

    margin-top: 25px;
    margin-bottom: 35px;

}


/* ===================================== */
/* การ์ดแต่ละห้องเรียน */
/* ===================================== */

#room-list .room {

    display: flex;
    flex-direction: column;

    min-width: 0;
    width: auto;

    padding: 22px;

    margin: 0;

    background: #ffffff;

    border: 1px solid #e2e8f0;
    border-radius: 14px;

    box-shadow:
        0 3px 12px rgba(0, 0, 0, 0.05);

    box-sizing: border-box;

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;

}


/* เมื่อนำเมาส์ไปชี้ */

#room-list .room:hover {

    transform: translateY(-3px);

    box-shadow:
        0 8px 20px rgba(0, 0, 0, 0.09);

}


/* ชื่อห้องเรียน */

#room-list .room h3 {

    margin: 0 0 10px;

    font-size: 17px;
    line-height: 1.5;

    color: #1e3a5f;

}


/* หมายเลขห้อง */

#room-list .room > p {

    margin: 0 0 18px;

    font-size: 14px;

    color: #64748b;

}


/* ===================================== */
/* กล่องข้อมูลสรุปในแต่ละห้อง */
/* ===================================== */

.room-summary {

    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 10px;

    margin-bottom: 20px;

}


/* ช่องแสดงตัวเลข */

.room-metric {

    background: #f8fafc;

    border: 1px solid #edf2f7;
    border-radius: 9px;

    padding: 12px 10px;

    text-align: center;

}


/* ชื่อข้อมูล */

.room-metric span {

    display: block;

    font-size: 12px;

    color: #64748b;

    margin-bottom: 7px;

}


/* จำนวนข้อมูล */

.room-metric strong {

    display: block;

    font-size: 24px;
    font-weight: 700;

    color: #1e3a5f;

}


/* สีตัวเลขสถานะ */

.room-metric-normal strong {
    color: #16a34a;
}

.room-metric-damaged strong {
    color: #dc2626;
}

.room-metric-repairing strong {
    color: #d97706;
}

.room-metric-sets strong {
    color: #2563eb;
}


/* ===================================== */
/* ปุ่มดูอุปกรณ์ */
/* ===================================== */

#room-list .room button {

    width: 100%;

    margin-top: auto;

    padding: 12px 15px;

    background: #2563eb;

    color: white;

    border: none;
    border-radius: 8px;

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;

}


#room-list .room button:hover {

    background: #1d4ed8;

}


/* ===================================== */
/* รองรับหน้าจอขนาดต่าง ๆ */
/* ===================================== */

/* หน้าจอขนาดกลาง */

@media (max-width: 1200px) {

    #room-list {

        grid-template-columns:
            repeat(2, minmax(0, 1fr));

    }

}


/* โทรศัพท์มือถือ */

@media (max-width: 650px) {

    #room-list {

        grid-template-columns: 1fr;

        gap: 15px;

    }

    #room-list .room {
        padding: 18px;
    }

}

/* =========================================
   DBT PURPLE THEME
========================================= */

:root {
    --dbt-dark: #3B176B;
    --dbt-primary: #6D28D9;
    --dbt-purple: #7C3AED;
    --dbt-light: #EDE9FE;
    --dbt-background: #F8F7FC;
    --dbt-text: #31264B;
}


/* =========================================
   พื้นหลังเว็บไซต์
========================================= */

body {
    background-color: var(--dbt-background);
    color: var(--dbt-text);
}


/* =========================================
   ส่วนหัวเว็บไซต์
========================================= */

.site-header {
    position: relative;

    background: linear-gradient(
        115deg,
        #32115C 0%,
        #54218D 55%,
        #793CC5 100%
    );

    padding: 30px 25px;

    border-bottom: 4px solid #C4B5FD;

    box-shadow: 0 4px 15px rgba(76, 29, 149, 0.12);

    text-align: left;
}


/* จัดเนื้อหาภายในส่วนหัว */

.site-header-inner {
    width: 100%;
    max-width: 1280px;

    margin: 0 auto;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 35px;
}


/* =========================================
   โลโก้และชื่อสาขา
========================================= */

.site-brand {
    display: flex;
    align-items: center;
    gap: 22px;

    min-width: 0;
}


/* สัญลักษณ์ DBT */

.site-brand-logo {
    width: 76px;
    height: 76px;

    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    background: rgba(255, 255, 255, 0.12);

    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 18px;

    color: white;

    font-size: 27px;
    font-weight: 800;
    letter-spacing: 1px;
}


/* กลุ่มข้อความ */

.site-brand-content {
    text-align: left;
}


/* ชื่อระบบ */

.site-header .site-brand-content h1 {
    margin: 0 0 7px;

    color: #FFFFFF;

    font-size: 29px;
    font-weight: 700;

    line-height: 1.4;
}


/* ชื่อสาขา */

.site-header .site-brand-content h2 {
    margin: 0 0 5px;

    color: #F3E8FF;

    font-size: 19px;
    font-weight: 600;

    line-height: 1.5;
}


/* ชื่อภาษาอังกฤษ */

.site-header .site-brand-content p {
    margin: 0;

    color: #DDD6FE;

    font-size: 14px;
    font-weight: 400;

    letter-spacing: 0.4px;
}


/* =========================================
   ข้อมูลบัญชีผู้ใช้
========================================= */

.site-header #account-info:not([hidden]) {
    display: flex;
    align-items: center;
    gap: 16px;

    flex-shrink: 0;
}

.site-header #account-info[hidden] {
    display: none !important;
}

.site-account-details {
    display: flex;
    flex-direction: column;

    gap: 5px;

    text-align: right;
}

.site-account-label {
    color: #DDD6FE;

    font-size: 12px;
}

.site-header #user-email {
    color: #FFFFFF;

    font-size: 13px;
    font-weight: 600;

    overflow-wrap: anywhere;
}


/* ปุ่มออกจากระบบ */

.site-header #logout-btn {
    background: rgba(255, 255, 255, 0.13);

    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 9px;

    color: #FFFFFF;

    padding: 12px 16px;

    font-size: 13px;
    font-weight: 600;

    cursor: pointer;

    white-space: nowrap;

    transition: background 0.2s;
}

.site-header #logout-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}


/* =========================================
   รองรับจอแท็บเล็ต
========================================= */

@media (max-width: 900px) {

    .site-header-inner {
        flex-direction: column;
        align-items: flex-start;

        gap: 22px;
    }

    .site-account-details {
        text-align: left;
    }

}


/* =========================================
   รองรับโทรศัพท์มือถือ
========================================= */

@media (max-width: 600px) {

    .site-header {
        padding: 24px 18px;
    }

    .site-brand {
        gap: 14px;
        align-items: flex-start;
    }

    .site-brand-logo {
        width: 54px;
        height: 54px;

        font-size: 18px;
        border-radius: 12px;
    }

    .site-header .site-brand-content h1 {
        font-size: 20px;
    }

    .site-header .site-brand-content h2 {
        font-size: 15px;
    }

    .site-header .site-brand-content p {
        font-size: 12px;
    }

    .site-header #account-info:not([hidden]) {
        flex-wrap: wrap;
        gap: 12px;
    }

}
/* =========================================
   DASHBOARD MENU BUTTONS
   กำหนดปุ่มหลักให้ขนาดเท่ากัน
========================================= */

#dashboard #manage-repairs-btn,
#dashboard #open-equipment-search,
#dashboard #open-user-management,
#dashboard #open-repair-history {

    display: inline-flex;

    align-items: center;
    justify-content: center;

    width: 205px;
    height: 50px;
    min-height: 50px;

    box-sizing: border-box;

    padding: 0 14px;

    margin: 0 8px 12px 0;

    background: #6D28D9;
    color: #FFFFFF;

    border: none;
    border-radius: 10px;

    font-family: inherit;
    font-size: 14px;
    font-weight: 600;

    white-space: nowrap;

    cursor: pointer;

    vertical-align: middle;

    transition:
        background-color 0.2s,
        transform 0.2s,
        box-shadow 0.2s;
}


/* เมื่อเลื่อนเมาส์ */

#dashboard #manage-repairs-btn:hover,
#dashboard #open-equipment-search:hover,
#dashboard #open-user-management:hover,
#dashboard #open-repair-history:hover {

    background: #5B21B6;

    transform: translateY(-2px);

    box-shadow: 0 4px 12px rgba(109, 40, 217, 0.18);
}


/* ปุ่มที่ซ่อนต้องไม่แสดง */

#dashboard #manage-repairs-btn[hidden],
#dashboard #open-user-management[hidden] {
    display: none !important;
}


/* บนอุปกรณ์หน้าจอเล็ก */

@media (max-width: 600px) {

    #dashboard #manage-repairs-btn,
    #dashboard #open-equipment-search,
    #dashboard #open-user-management,
    #dashboard #open-repair-history {

        width: 100%;
        margin-right: 0;

    }

}
/* =========================================
   DASHBOARD PURPLE THEME
========================================= */

/* หัวข้อหลัก */

#dashboard > h2 {
    color: #4C1D95;
}


/* การ์ดสรุปจำนวนทั้งหมด */

#dashboard .summary .card {
    background: #FFFFFF;

    border: 1px solid #EDE9FE;
    border-radius: 14px;

    box-shadow: 0 4px 12px rgba(76, 29, 149, 0.06);
}


/* ชื่อการ์ด */

#dashboard .summary .card h3 {
    color: #6B5C82;
}


/* ตัวเลขบนการ์ด */

#dashboard .summary .card p {
    color: #5B21B6;
}


/* การ์ดห้องเรียน */

#room-list .room {
    border: 1px solid #E9D5FF;
}

#room-list .room:hover {
    border-color: #A78BFA;
}


/* ชื่อห้องเรียน */

#room-list .room h3 {
    color: #4C1D95;
}


/* พื้นหลังกล่องตัวเลข */

#room-list .room-metric {
    background: #FAF8FF;
    border-color: #F1EAFE;
}


/* ปุ่มเข้าห้องเรียน */

#room-list .room button {
    background: #7C3AED;
}

#room-list .room button:hover {
    background: #6D28D9;
}


/* หัวข้อรายงาน */

.report-heading h2,
.report-card h3 {
    color: #4C1D95;
}


/* หัวตารางต่าง ๆ */

.inventory-table th,
.report-table th,
.user-management-table th {
    background: #4C1D95;
    color: white;
}


/* ปุ่มรีเฟรชรายงาน */

#refresh-dashboard-reports {
    background: #6D28D9;
}

#refresh-dashboard-reports:hover {
    background: #5B21B6;
}

/* =========================================
   DBT GLOBAL PAGE DESIGN
========================================= */

/* หัวข้อหลักทุกหน้า */

main h2 {
    color: #4C1D95;
    font-weight: 700;
}

/* หัวข้อรอง */

main h3 {
    color: #5B21B6;
    font-weight: 600;
}

/* ข้อความทั่วไป */

main {
    color: #31264B;
}

/* เพิ่มเส้นตกแต่งใต้หัวข้อของหน้าหลัก */

#room-detail > h2,
#equipment-detail > h2,
#add-equipment-page > h2,
#edit-equipment-page > h2,
#equipment-search-page > h2,
#repair-admin-page > h2,
#repair-history-page > h2,
#user-management-page > h2,
#manage-sets-page > h2 {

    padding-bottom: 12px;

    border-bottom: 2px solid #E9D5FF;

    margin-bottom: 25px;
}

/* =========================================
   DBT FORM DESIGN
========================================= */

/* ช่องกรอกข้อมูลภายในหน้าหลัก */

main input:not([type="checkbox"]):not([type="radio"]),
main select,
main textarea {

    border: 1px solid #D8C9EC;

    border-radius: 9px;

    background-color: #FFFFFF;

    color: #31264B;

    font-family: inherit;

    transition:
        border-color 0.2s,
        box-shadow 0.2s;
}


/* เมื่อคลิกช่องกรอกข้อมูล */

main input:not([type="checkbox"]):not([type="radio"]):focus,
main select:focus,
main textarea:focus {

    outline: none;

    border-color: #8B5CF6;

    box-shadow:
        0 0 0 3px rgba(139, 92, 246, 0.13);
}


/* สีข้อความกำกับช่องกรอก */

main label {

    color: #4C1D95;

    font-weight: 600;

}


/* ช่องกรอกข้อมูลที่ปิดใช้งาน */

main input:disabled,
main select:disabled,
main textarea:disabled {

    background-color: #F3F0F8;

    color: #81758F;

    cursor: not-allowed;

}

/* =========================================
   DBT TABLE DESIGN
========================================= */

/* หัวตารางทุกหน้าหลัก */

main table thead th {

    background-color: #4C1D95;

    color: #FFFFFF;

    font-weight: 600;

    border-color: #4C1D95;

}


/* เส้นแบ่งแถว */

main table tbody td {

    border-bottom: 1px solid #EEE7F6;

}


/* สีพื้นหลังเมื่อเลื่อนเมาส์ */

main table tbody tr:hover {

    background-color: #F7F2FF;

}


/* ตารางแถวสลับสี */

main table tbody tr:nth-child(even) {

    background-color: #FCFAFF;

}

main table tbody tr:nth-child(even):hover {

    background-color: #F7F2FF;

}

/* =========================================
   DBT BACK BUTTONS
========================================= */

#back-room,
#back-dashboard,
#back-from-equipment-search,
#back-from-manage-sets,
#back-from-user-management {

    display: inline-flex;

    align-items: center;
    justify-content: center;

    min-height: 44px;

    padding: 10px 18px;

    background-color: #736384;

    color: #FFFFFF;

    border: none;
    border-radius: 9px;

    font-family: inherit;
    font-size: 14px;
    font-weight: 600;

    cursor: pointer;

    transition:
        background-color 0.2s,
        transform 0.2s;

}


/* เมื่อนำเมาส์ไปชี้ */

#back-room:hover,
#back-dashboard:hover,
#back-from-equipment-search:hover,
#back-from-manage-sets:hover,
#back-from-user-management:hover {

    background-color: #5D4B71;

    transform: translateY(-1px);

}

/* =========================================
   DBT ACTION BUTTONS
========================================= */

/* ปุ่มค้นหา */

#search-submit-btn {
    background-color: #7C3AED;
    color: white;
}

#search-submit-btn:hover {
    background-color: #6D28D9;
}


/* ปุ่มรีเฟรช Dashboard */

#refresh-dashboard-reports {
    background-color: #7C3AED;
    color: white;
}


/* ปุ่มจัดการชุดคอมพิวเตอร์ */

#manage-sets-btn {
    background-color: #7C3AED;
    color: white;
}

#manage-sets-btn:hover {
    background-color: #6D28D9;
}


/* ปุ่มแก้ไขชุดคอมพิวเตอร์ */

.set-manager-edit {
    background-color: #7C3AED;
}

.set-manager-edit:hover {
    background-color: #6D28D9;
}


/* ปุ่มบันทึกสิทธิ์ผู้ใช้งาน */

.user-role-save:not(:disabled) {
    background-color: #7C3AED;
}

.user-role-save:not(:disabled):hover {
    background-color: #6D28D9;
}


/* ปุ่ม Excel ยังคงสีเขียว */

#export-equipment-xlsx {
    background-color: #16A34A;
}


/* ปุ่ม PDF ใช้ม่วงเข้ม */

#save-equipment-pdf:not(:disabled) {
    background-color: #5B21B6;
}


/* ปุ่มลบยังเป็นสีแดง */

.set-manager-archive {
    background-color: #DC2626;
}


/* ปุ่มกู้คืนยังเป็นสีเขียว */

.set-manager-restore {
    background-color: #16A34A;
}

/* =========================================
   INVENTORY VIEW SWITCH
========================================= */

.inventory-view-switch button {

    background-color: #FFFFFF;

    color: #5B21B6;

    border: 1px solid #DDD6FE;

    border-radius: 9px;

}


/* มุมมองที่กำลังเลือกอยู่ */

.inventory-view-switch button[aria-pressed="true"] {

    background-color: #6D28D9;

    border-color: #6D28D9;

    color: #FFFFFF;

}


/* เมื่อนำเมาส์ไปชี้ */

.inventory-view-switch button:hover {

    border-color: #8B5CF6;

}

/* =========================================
   DBT ROOM SEARCH
   ระบบค้นหาห้องเรียน
========================================= */

.room-search-panel {
    background: #ffffff;

    border: 1px solid #e9d5ff;
    border-radius: 14px;

    padding: 20px 24px;
    margin: 20px 0 25px;

    box-shadow:
        0 3px 12px rgba(76, 29, 149, 0.05);
}


/* ชื่อช่องค้นหา */

.room-search-content label {
    display: block;

    color: #4c1d95;

    font-size: 15px;
    font-weight: 600;

    margin-bottom: 12px;
}


/* ช่องค้นหาและปุ่ม */

.room-search-controls {
    display: flex;

    align-items: center;
    gap: 12px;
}


/* ช่องกรอกค้นหา */

#room-search-input {
    flex: 1;

    width: 100%;
    min-width: 0;

    height: 46px;

    padding: 0 16px;

    background: #ffffff;

    border: 1px solid #ddd6fe;
    border-radius: 9px;

    font-size: 15px;
    font-family: inherit;

    box-sizing: border-box;
}


/* เมื่อคลิกช่องค้นหา */

#room-search-input:focus {
    outline: none;

    border-color: #8b5cf6;

    box-shadow:
        0 0 0 3px rgba(139, 92, 246, 0.12);
}


/* ปุ่มล้างการค้นหา */

#clear-room-search {
    height: 46px;

    padding: 0 20px;

    background: #ede9fe;
    color: #5b21b6;

    border: 1px solid #ddd6fe;
    border-radius: 9px;

    font-size: 14px;
    font-weight: 600;
    font-family: inherit;

    cursor: pointer;

    white-space: nowrap;
}


/* เมื่อเลื่อนเมาส์ */

#clear-room-search:hover {
    background: #ddd6fe;
}


/* จำนวนห้องที่พบ */

#room-search-result {
    margin: 14px 0 0;

    color: #6b5c82;

    font-size: 14px;
}


/* ไม่พบห้องเรียน */

#room-search-empty {
    padding: 20px;

    text-align: center;

    background: #faf5ff;
    color: #6d28d9;

    border: 1px dashed #c4b5fd;
    border-radius: 12px;

    font-weight: 600;
}


/* สำคัญ: ห้องที่ถูกซ่อนต้องไม่แสดง */

#room-list .room[hidden],
#room-search-empty[hidden] {
    display: none !important;
}

/* =========================================
   MOBILE RESPONSIVE DASHBOARD
========================================= */

@media (max-width: 650px) {

    /* การ์ดสรุปด้านบน */

    #dashboard .summary {
        display: grid;

        grid-template-columns:
            repeat(2, minmax(0, 1fr));

        gap: 12px;
    }


    #dashboard .summary .card {
        min-width: 0;
        width: auto;

        margin: 0;
        padding: 16px 10px;
    }


    #dashboard .summary .card h3 {
        font-size: 13px;
        line-height: 1.5;
    }


    #dashboard .summary .card p {
        font-size: 28px;
    }


    /* กล่องค้นหาห้องเรียน */

    .room-search-panel {
        padding: 16px;
    }


    .room-search-controls {
        flex-direction: column;
        align-items: stretch;
    }


    #room-search-input {
        width: 100%;
        flex: none;
    }


    #clear-room-search {
        width: 100%;
    }


    /* การ์ดห้องเรียน */

    #room-list {
        grid-template-columns: 1fr;
    }


    #room-list .room {
        width: 100%;
        box-sizing: border-box;
    }


    /* ตารางเลื่อนแนวนอนได้ */

    .inventory-table-scroll,
    .report-table-scroll,
    .table-scroll,
    .user-management-table-wrap {

        max-width: 100%;

        overflow-x: auto;

        -webkit-overflow-scrolling: touch;

    }

}

/* =========================================
   DBT PDF REPORT - MULTI PAGE
========================================= */

/* พื้นที่สร้างเอกสาร PDF */

#inventory-print-root.pdf-export {
    display: block !important;
    position: static !important;

    width: 270mm !important;
    height: auto !important;

    padding: 0 !important;
    margin: 0 !important;

    background: #ffffff !important;

    visibility: visible !important;
    opacity: 1 !important;
}


/* กระดาษแต่ละหน้า */

.dbt-pdf-page {
    width: 270mm;
    height: 190mm;

    position: relative;
    overflow: hidden;

    box-sizing: border-box;

    padding: 0;
    margin: 0;

    background: #ffffff;
    color: #222222;

    font-family: "Sarabun", Tahoma, sans-serif;
}

.dbt-pdf-page * {
    box-sizing: border-box;
}


/* =========================================
   หัวข้อเอกสาร
========================================= */

.dbt-pdf-title {
    margin: 0;

    text-align: center;

    color: #4c1d95;

    font-size: 24px;
    font-weight: 700;

    line-height: 1.4;
}

.dbt-pdf-subtitle {
    margin: 0 0 13px;

    text-align: center;

    color: #5b21b6;

    font-size: 18px;
    font-weight: 600;
}


/* =========================================
   รายละเอียดตัวกรอง
========================================= */

.dbt-pdf-info {
    display: grid;

    grid-template-columns: 1fr 1fr;

    gap: 5px 15px;

    margin-bottom: 14px;

    font-size: 12px;
    line-height: 1.4;
}


/* =========================================
   ตารางครุภัณฑ์
========================================= */

.dbt-pdf-table {
    width: 100%;

    table-layout: fixed;
    border-collapse: collapse;

    font-size: 11px;
}

.dbt-pdf-table th,
.dbt-pdf-table td {
    border: 1px solid #a7a0b5;

    padding: 5px 4px;

    line-height: 1.3;
    vertical-align: middle;

    overflow-wrap: anywhere;
}

.dbt-pdf-table th {
    background: #4c1d95;

    color: #ffffff;

    font-weight: 700;
    text-align: center;
}

.dbt-pdf-table td:nth-child(1),
.dbt-pdf-table td:nth-child(7),
.dbt-pdf-table td:nth-child(8),
.dbt-pdf-table td:nth-child(9) {
    text-align: center;
}

.dbt-pdf-table tbody tr:nth-child(even) {
    background: #faf7ff;
}


/* =========================================
   ส่วนท้ายกระดาษ
========================================= */

.dbt-pdf-footer {
    position: absolute;

    bottom: 0;
    left: 0;
    right: 0;

    height: 25px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    border-top: 1px solid #d8c9ec;

    color: #5b4b71;

    font-size: 11px;

    background: #ffffff;
}

/* ซ่อนปุ่มตามสิทธิ์ผู้ใช้งาน */

#dashboard #open-repair-history[hidden],
#dashboard #manage-repairs-btn[hidden],
#dashboard #open-user-management[hidden] {
    display: none !important;
}

/* =========================================
   DBT ROOM INVENTORY
========================================= */

#room-detail .room-inventory-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin: 22px 0;
}

.room-stat-box {
    background: #fff;
    border: 1px solid #e9d5ff;
    border-radius: 12px;
    padding: 18px;
    text-align: center;
}

.room-stat-box span {
    display: block;
    color: #766887;
    font-size: 14px;
    margin-bottom: 8px;
}

.room-stat-box strong {
    display: block;
    color: #5b21b6;
    font-size: 27px;
}

.room-inventory-toolbar {
    background: #fff;
    border: 1px solid #e9d5ff;
    border-radius: 14px;
    padding: 22px;
    margin: 22px 0;
}

.room-inventory-toolbar h3 {
    margin-top: 0;
}

#room-item-search {
    width: 100%;
    min-height: 46px;
    padding: 12px;
    border: 1px solid #ddd6fe;
    border-radius: 9px;
    box-sizing: border-box;
}

.room-inventory-filters {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
    gap: 12px;
    align-items: end;
    margin-top: 16px;
}

.room-inventory-filters label {
    display: block;
    margin-bottom: 8px;
}

.room-inventory-filters select,
#room-item-page-size {
    width: 100%;
    min-height: 43px;
    padding: 8px;
    border: 1px solid #ddd6fe;
    border-radius: 8px;
    background: #fff;
}

#room-item-reset {
    min-height: 43px;
    background: #ede9fe;
    color: #5b21b6;
    border: 0;
    border-radius: 8px;
    padding: 0 18px;
    cursor: pointer;
}

.room-inventory-view-switch {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.room-inventory-view-switch button {
    padding: 12px 18px;
    background: #f5f3ff;
    color: #5b21b6;
    border: 1px solid #ddd6fe;
    border-radius: 9px;
    cursor: pointer;
}

.room-inventory-view-switch button[aria-pressed="true"] {
    background: #6d28d9;
    border-color: #6d28d9;
    color: #fff;
}

.room-inventory-result-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px;
}

.room-inventory-result-bar p {
    margin: 0;
}

.room-inventory-result-bar label {
    display: flex;
    align-items: center;
    gap: 10px;
}

#room-item-page-size {
    width: 85px;
}

/* มุมมองการ์ด */

.room-inventory-results.room-view-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.room-group-card {
    min-width: 0;
    background: #fff;
    border: 1px solid #e9d5ff;
    border-radius: 13px;
    padding: 20px;
}

.room-group-card.has-damage {
    border-left: 4px solid #dc2626;
}

.room-group-card h3 {
    margin: 0 0 14px;
}

.room-group-card.is-expanded {
    grid-column: 1 / -1;
}

.room-group-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 15px 0;
}

.room-group-metrics span {
    background: #faf7ff;
    border-radius: 8px;
    padding: 12px;
    font-size: 13px;
}

.room-group-card details {
    margin-top: 16px;
}

.room-group-card summary {
    padding: 12px;
    background: #6d28d9;
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
}

/* มุมมองแบบละเอียด */

.room-inventory-results.room-view-detail {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.room-group-detail {
    background: #fff;
    border: 1px solid #e9d5ff;
    border-radius: 12px;
    padding: 16px;
}

.room-group-detail.has-damage {
    border-left: 4px solid #dc2626;
}

.room-group-detail summary {
    cursor: pointer;
    font-weight: 600;
    color: #4c1d95;
    padding: 8px;
}

/* ตาราง */

.room-inventory-results .table-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    margin-top: 14px;
}

.room-inventory-results table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.room-inventory-results th,
.room-inventory-results td {
    padding: 11px;
    border-bottom: 1px solid #eee7f6;
    text-align: left;
}

.room-inventory-results th {
    background: #4c1d95;
    color: #fff;
}

/* การแบ่งหน้า */

.room-inventory-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 25px 0 40px;
}

.room-inventory-pagination button {
    min-height: 40px;
    padding: 8px 14px;
    border: 1px solid #ddd6fe;
    border-radius: 8px;
    background: #fff;
    color: #5b21b6;
    cursor: pointer;
}

.room-inventory-pagination button[aria-current="page"] {
    background: #6d28d9;
    border-color: #6d28d9;
    color: #fff;
}

.room-inventory-pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#room-item-page-numbers {
    display: flex;
    gap: 6px;
}

/* รองรับแท็บเล็ตและโทรศัพท์ */

@media (max-width: 1000px) {
    .room-inventory-results.room-view-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .room-inventory-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 650px) {
    #room-detail .room-inventory-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .room-inventory-results.room-view-cards,
    .room-inventory-filters {
        grid-template-columns: 1fr;
    }

    .room-inventory-toolbar {
        padding: 16px;
    }

    .room-inventory-view-switch button {
        flex: 1;
        padding: 11px 8px;
        font-size: 12px;
    }
}

/* ให้ hidden ทำงานแม้มี display จาก CSS อื่น */

#room-item-pagination[hidden],
#other-equipment[hidden] {
    display: none !important;
}

/* =========================================
   DBT ROOM FILTER - IMPROVED DESIGN
   ปรับขนาดช่องค้นหาและตัวกรอง
========================================= */

/* ชื่อหัวข้อตัวกรอง */

#room-detail .room-inventory-filters label {
    display: block;

    font-size: 16px;
    font-weight: 600;

    color: #4c1d95;

    margin-bottom: 10px;
}


/* ช่องเลือกสถานะ หมวดหมู่ และเรียงลำดับ */

#room-detail .room-inventory-filters select {

    width: 100%;

    height: 50px;
    min-height: 50px;

    padding: 10px 14px;

    font-size: 16px;
    font-weight: 500;
    font-family: inherit;

    color: #31264b;
    background-color: #ffffff;

    border: 1.5px solid #d8b4fe;
    border-radius: 10px;

    box-sizing: border-box;

    cursor: pointer;

    transition:
        border-color 0.2s,
        box-shadow 0.2s;
}


/* เมื่อเลือกช่อง */

#room-detail .room-inventory-filters select:focus {

    outline: none;

    border-color: #7c3aed;

    box-shadow:
        0 0 0 3px rgba(124, 58, 237, 0.12);

}


/* ช่องค้นหา */

#room-detail #room-item-search {

    width: 100%;

    height: 52px;
    min-height: 52px;

    padding: 12px 16px;

    font-size: 16px;
    font-family: inherit;

    border: 1.5px solid #d8b4fe;
    border-radius: 10px;

    box-sizing: border-box;

}


/* ข้อความตัวอย่างในช่องค้นหา */

#room-detail #room-item-search::placeholder {

    color: #9385a6;

    font-size: 15px;

}


/* ปุ่มล้างตัวกรอง */

#room-detail #room-item-reset {

    height: 50px;
    min-height: 50px;

    padding: 0 22px;

    font-size: 15px;
    font-weight: 600;

    background: #ede9fe;
    color: #5b21b6;

    border: 1px solid #ddd6fe;
    border-radius: 10px;

}


/* ช่องเลือกจำนวนรายการต่อหน้า */

#room-detail #room-item-page-size {

    width: 95px;

    height: 44px;
    min-height: 44px;

    padding: 8px 10px;

    font-size: 15px;

    border: 1.5px solid #d8b4fe;
    border-radius: 9px;

}


/* เพิ่มระยะห่างระหว่างช่อง */

#room-detail .room-inventory-filters {

    gap: 16px;

    margin-top: 20px;
    margin-bottom: 18px;

}


/* รองรับโทรศัพท์ */

@media (max-width: 650px) {

    #room-detail .room-inventory-filters {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    #room-detail #room-item-reset {
        width: 100%;
    }

}

/* =========================================
   DBT EQUIPMENT DETAIL BUTTON
========================================= */

#room-detail .room-inventory-results
table tbody td:last-child button {

    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 115px;
    min-height: 42px;

    padding: 10px 16px;

    background-color: #ede9fe;
    color: #5b21b6;

    border: 1px solid #c4b5fd;
    border-radius: 9px;

    font-family: inherit;
    font-size: 14px;
    font-weight: 600;

    cursor: pointer;

    transition:
        background-color 0.2s,
        transform 0.2s,
        box-shadow 0.2s;
}


/* เมื่อนำเมาส์ไปชี้ */

#room-detail .room-inventory-results
table tbody td:last-child button:hover {

    background-color: #7c3aed;
    color: #ffffff;

    transform: translateY(-1px);

    box-shadow:
        0 3px 10px rgba(124, 58, 237, 0.18);
}


/* เมื่อใช้คีย์บอร์ดเลือกปุ่ม */

#room-detail .room-inventory-results
table tbody td:last-child button:focus-visible {

    outline: 3px solid #c4b5fd;
    outline-offset: 2px;
}

/* =========================================
   DBT ROOM EQUIPMENT TABLE
========================================= */

/* กล่องตาราง */

#room-detail .room-inventory-results
.table-scroll {

    width: 100%;
    max-width: 100%;

    overflow-x: auto;

    background: #ffffff;

    border: 1px solid #e9d5ff;
    border-radius: 12px;

    box-sizing: border-box;

    -webkit-overflow-scrolling: touch;
}


/* ตาราง */

#room-detail .room-inventory-results
table {

    width: 100%;

    border-collapse: collapse;

    min-width: 760px;

    font-size: 14px;
}


/* หัวตาราง */

#room-detail .room-inventory-results
table thead th {

    background: #4c1d95;
    color: #ffffff;

    padding: 16px 14px;

    font-size: 14px;
    font-weight: 600;

    line-height: 1.5;

    text-align: left;
    white-space: nowrap;
}


/* ข้อมูลในตาราง */

#room-detail .room-inventory-results
table tbody td {

    padding: 14px;

    border-bottom: 1px solid #eee7f6;

    color: #31264b;

    font-size: 14px;
    line-height: 1.6;

    vertical-align: middle;
}


/* แถวสลับสี */

#room-detail .room-inventory-results
table tbody tr:nth-child(even) {

    background-color: #faf8ff;
}


/* เมื่อเลื่อนเมาส์ */

#room-detail .room-inventory-results
table tbody tr:hover {

    background-color: #f3e8ff;
}


/* แถวสุดท้าย */

#room-detail .room-inventory-results
table tbody tr:last-child td {

    border-bottom: none;
}


/* สีสถานะอุปกรณ์ */

#room-detail .room-inventory-results
table td.status-normal {

    color: #16a34a;
    font-weight: 700;
}

#room-detail .room-inventory-results
table td.status-damaged {

    color: #dc2626;
    font-weight: 700;
}

#room-detail .room-inventory-results
table td.status-repair {

    color: #d97706;
    font-weight: 700;
}

#room-detail .room-inventory-results
table td.status-retired {

    color: #64748b;
    font-weight: 700;
}

/* =========================================
   DBT COMPUTER SET CARDS
========================================= */

#room-detail .room-group-card {

    background: #ffffff;

    border: 1px solid #e9d5ff;
    border-radius: 15px;

    padding: 22px;

    box-shadow:
        0 4px 14px rgba(76, 29, 149, 0.06);

    transition:
        transform 0.2s,
        box-shadow 0.2s,
        border-color 0.2s;
}


/* เมื่อนำเมาส์ไปชี้ */

#room-detail .room-group-card:hover {

    border-color: #c4b5fd;

    transform: translateY(-2px);

    box-shadow:
        0 8px 22px rgba(76, 29, 149, 0.1);
}


/* ชื่อชุดคอมพิวเตอร์ */

#room-detail .room-group-card h3 {

    color: #4c1d95;

    font-size: 18px;
    font-weight: 700;

    margin-bottom: 14px;
}


/* กล่องสรุปจำนวน */

#room-detail .room-group-metrics span {

    background: #faf7ff;

    color: #31264b;

    border: 1px solid #f1eafe;
    border-radius: 9px;

    padding: 13px;

    font-size: 13px;
}


/* ปุ่มขยายการ์ด */

#room-detail .room-group-card summary {

    background: #7c3aed;

    color: #ffffff;

    border-radius: 9px;

    padding: 13px;

    font-weight: 600;
}


/* เมื่อเลื่อนเมาส์ไปชี้ */

#room-detail .room-group-card summary:hover {

    background: #6d28d9;
}


/* การ์ดที่มีอุปกรณ์ชำรุด */

#room-detail .room-group-card.has-damage,
#room-detail .room-group-detail.has-damage {

    border-left: 5px solid #dc2626;
}


/* การ์ดที่มีอุปกรณ์กำลังซ่อม */

#room-detail .room-group-card.has-repair,
#room-detail .room-group-detail.has-repair {

    border-left: 5px solid #d97706;
}