/* =========================================
   1. FILTER BOX (กล่องตัวกรองด้านบน)
   ========================================= */
.filter-card {
    background: white;
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border);
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    align-items: end;
}

.filter-group label {
    display: block;
    font-size: 13px;
    color: var(--text-sub);
    margin-bottom: 8px;
    font-weight: 500;
}

#sortMode {
max-width: 170px;
}

#filterDate {
    max-width: 170px;
}
/* =========================================
   2. HEADER & SUMMARY (สรุปยอด)
   ========================================= */
.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.summary-badges {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.badge-stat {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.bg-gray {
    background: #f1f5f9;
    color: #475569;
}

.bg-green {
    background: #dcfce7;
    color: #166534;
}

.bg-red {
    background: #fee2e2;
    color: #991b1b;
}

/* =========================================
   3. DATA TABLE (ตารางข้อมูล) - จุดสำคัญ!
   ========================================= */
.card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    border: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    /* ให้เลื่อนแนวนอนได้ในมือถือ */
    border-radius: 12px;
    border: 1px solid var(--border);
}

.data-table {
    width: 100%;
    min-width: 1000px;
    /* 🔥 บังคับความกว้างขั้นต่ำ (กันเบียด) */
    border-collapse: collapse;
    table-layout: fixed;
    /* 🔥 สำคัญมาก! ล็อกความกว้างคอลัมน์ให้เป๊ะ */
}

/* --- การจัดตำแหน่ง (ใช้กับทั้ง th และ td) --- */
.cell-center {
    text-align: center !important;
}

.cell-left {
    text-align: left !important;
}

/* --- สไตล์หัวตาราง (th) --- */
.data-table th {
    padding: 16px;
    background-color: #f8fafc;
    color: var(--text-sub);
    font-weight: 600;
    font-size: 14px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    /* ห้ามขึ้นบรรทัดใหม่ */
}

/* --- สไตล์ข้อมูล (td) --- */
.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    font-size: 14px;
    color: var(--text-main);

    /* ตัดคำถ้าล้น */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover {
    background-color: #f8fafc;
}

/* --- กำหนดความกว้างคอลัมน์ (รวมกัน = 100%) --- */
.w-date {
    width: 12%;
}

.w-id {
    width: 10%;
}

.w-name {
    width: 20%;
}

.w-time {
    width: 12%;
}

/* เข้า */
.w-time {
    width: 12%;
}

/* ออก */
.w-branch {
    width: 15%;
}

.w-map {
    width: 19%;
}

/* --- องค์ประกอบย่อยในตาราง --- */
.col-id {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: var(--primary);
    background: #eff6ff;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 13px;
    display: inline-block;
    margin-left: 5px;
}

.user-name {
    font-weight: 600;
    display: block;
}

/* ป้ายเวลา (Time Box) */
.time-box {
    display: inline-block;
    width: 80px;
    /* ล็อกความกว้างป้ายเวลา */
    padding: 4px 0;
    border-radius: 6px;
    font-weight: 600;
    text-align: center;
    font-size: 14px;
    margin-left: 10px;
}

.time-in {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.time-out {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.time-empty {
    background: #f1f5f9;
    color: #cbd5e1;
    font-weight: normal;
}

/* ปุ่มแผนที่ */
.btn-map {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    text-decoration: none;
    background-color: #fff;
    color: var(--primary);
    border: 1px solid var(--primary);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    transition: 0.2s;
}

.btn-map:hover {
    background-color: var(--primary);
    color: white;
}

.text-center {
    text-align: center;
    padding: 40px;
    color: var(--text-sub);
}



/* สั่งให้ทุก element คิดขนาดรวมขอบและ padding (กันเบี้ยว) */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* --- บังคับทิศทางข้อความใน td ให้ตรงกับ th ตามลำดับ --- */

/* คอลัมน์ 1: วันที่ (th=Left -> td=Left) */
.data-table tbody td:nth-child(1) {
    text-align: left;
}

/* คอลัมน์ 2: ID (th=Center -> td=Center) */
.data-table tbody td:nth-child(2) {
    text-align: center;
}

/* คอลัมน์ 3: พนักงาน (th=Left -> td=Left) */
.data-table th:nth-child(3) {
    padding-left: 45px !important;
}

.data-table tbody td:nth-child(3) {
    text-align: left;
}

/* คอลัมน์ 4: เวลาเข้า (th=Center -> td=Center) */
.data-table tbody td:nth-child(4) {
    text-align: center;
}

/* คอลัมน์ 5: เวลาออก (th=Center -> td=Center) */
.data-table tbody td:nth-child(5) {
    text-align: center;
}

/* คอลัมน์ 6: สาขา (th=Left -> td=Left) */
.data-table tbody td:nth-child(6) {
    text-align: left;
}

/* คอลัมน์ 7: พิกัด (th=Center -> td=Center) */
.data-table tbody td:nth-child(7) {
    text-align: center;
}

.data-table th:nth-child(6),
.data-table td:nth-child(6) {
    padding-left: 80px !important;
    /* ของเดิม 16px เพิ่มเป็น 30px ให้มันถอยห่างออกมา */
}

CSS
/* =========================================
   7. BADGE COLORS (แต่งปุ่มสถานะด้านบน)
   ========================================= */

/* สไตล์พื้นฐานของทั้ง 3 ปุ่ม (จัดระยะ, ความมน) */
.badge-total,
.badge-in,
.badge-out {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    /* ระยะห่างระหว่างตัวหนังสือกับตัวเลข */
    padding: 8px 16px;
    /* ความอ้วนของปุ่ม */
    border-radius: 30px;
    /* มนๆ เหมือนแคปซูล */
    font-size: 14px;
    font-weight: 600;
    margin-right: 8px;
    /* ดันปุ่มถัดไปให้ห่างออกไป ไม่ติดกัน */
    border: 1px solid transparent;
    /* เตรียมเส้นขอบไว้ */
}

/* 1. พนักงานทั้งหมด (สีฟ้า - ให้ดูเป็นกลาง) */
.badge-total {
    background-color: #f2f2f2;
    color: #1e40af;
    border-color: #b3d1f6;
    border-radius: 30px;
    padding: 8px 16px;
    border: 1px;
}

/* 2. เช็คอิน (สีเขียว - ตามสั่ง) */
.badge-in {
    background-color: #f2f2f2;
    color: #166534;
    border-color: #e9fff0;
}

/* 3. เช็คเอาท์ (สีแดง - ตามสั่ง) */
.badge-out {
    background-color: #f2f2f2;
    color: #991b1b;
    border-color: #ffe8e8;
}

/* ... (โค้ดเดิมของมึงข้างบนเก็บไว้) ... */

/* =========================================
   8. CUSTOM MODAL (แก้ใหม่ ไม่ให้ค้าง)
   ========================================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    /* ฉากหลังสีดำโปร่งแสง */
    display: none;
    /* ซ่อนไว้ก่อน */
    justify-content: center;
    align-items: center;
    z-index: 9999;
    /* อยู่บนสุดแน่นอน */
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Class นี้จะถูกเติมด้วย JS เมื่อสั่งเปิด */
.modal-overlay.open {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 16px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    transform: scale(0.8);
    transition: transform 0.3s ease;
    text-align: center;
    /* จัดกลางให้สวย */
}

.modal-overlay.open .modal-content {
    transform: scale(1);
}

.modal-title {
    font-size: 22px;
    color: #1e293b;
    margin-bottom: 15px;
    font-weight: 700;
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 25px;
}

.btn-cancel,
.btn-confirm {
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-size: 14px;
}

.btn-cancel {
    background: #f1f5f9;
    color: #64748b;
}

.btn-cancel:hover {
    background: #e2e8f0;
}

.btn-confirm {
    background: #0ea5e9;
    color: white;
}

.btn-confirm:hover {
    background: #0284c7;
}


/* --- Modal & Profile Card Styling --- */
.clickable-row {
    cursor: pointer;
    transition: all 0.2s ease;
}

.clickable-row:hover {
    background-color: #f8fafc;
    transform: scale(1.005);
    z-index: 1;
    position: relative;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(3px);
}

.modal-overlay.open {
    opacity: 1;
}

.profile-card {
    background: white;
    width: 90%;
    max-width: 450px;
    border-radius: 16px;
    padding: 25px;
    position: relative;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.open .profile-card {
    transform: translateY(0);
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
}

.close-btn:hover {
    color: #ef4444;
}

.profile-header-section {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.profile-avatar {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    font-size: 24px;
    font-weight: bold;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.3);
}

.profile-title h2 {
    margin: 0;
    font-size: 1.25rem;
    color: #1e293b;
}

.badge-pos {
    display: inline-block;
    background: #f1f5f9;
    color: #64748b;
    font-size: 0.85rem;
    padding: 2px 8px;
    border-radius: 6px;
    margin-top: 4px;
}

.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.p-item {
    display: flex;
    flex-direction: column;
}

.p-item.full-width {
    grid-column: span 2;
}

.p-item label {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-bottom: 2px;
    font-weight: 500;
}

.p-item span {
    font-size: 0.95rem;
    font-weight: 500;
    color: #334155;
}

.acc-no {
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
    background: #f8fafc;
    padding: 8px;
    border-radius: 6px;
    border: 1px dashed #cbd5e1;
    text-align: center;
    font-weight: 600 !important;
}

.divider {
    border: 0;
    border-top: 1px solid #e2e8f0;
    margin: 20px 0;
}

.section-title {
    margin: 0 0 15px 0;
    font-size: 1rem;
    color: #475569;
    font-weight: 600;
}

/* --- Stats Section ใน Modal --- */
.stats-container {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    /* แบ่ง 3 ช่อง */
    gap: 15px;
    margin-bottom: 15px;
}

.stat-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 10px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    transition: transform 0.2s;
}

.stat-box:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    background: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.stat-info h3 {
    margin: 0;
    font-size: 1.4rem;
    color: #1e293b;
}

.stat-info small {
    color: #64748b;
    font-size: 0.75rem;
}

/* สีแยกแต่ละกล่อง */
.stat-box.work .stat-icon {
    background: #dbeafe;
    color: #2563eb;
}

/* สีฟ้า */
.stat-box.late .stat-icon {
    background: #fee2e2;
    color: #dc2626;
}

/* สีแดง */
.stat-box.leave .stat-icon {
    background: #dcfce7;
    color: #166534;
}

/* สีเขียว */

/* ปรับ Map ให้สวยขึ้นอีกนิด */
#mMapLink .btn-outlinem {
    display: flex;
    align-items: center;
    width: 100%;
    justify-content: center;
    padding: 3px 16px;
    background: rgb(247, 247, 247);
    color: #3572ff;
    border-bottom: 2px solid #0bb86a;
    gap: 5px;
    margin-top: 10px;
    border-radius: 9px;
    box-shadow: #1e293b33 0px 2px 4px;

    font-weight: bold;
}

#mMapLink .btn-outlinem:hover {
    background: #e4eef1;
    border-bottom: 2px solid #d21c19;
    color: rgb(24, 190, 96);
    box-shadow: 0 2px 4px rgba(8, 11, 16, 0.35);
}
/*Export*/
.export-buttons {
    display: flex;
    width: 100%;
    justify-content: center;   /* ✅ จัดกลางแนวนอน */
    align-items: center;
    gap: 10px;
}

.btn-outline {
    width: fit-content;
    display: flex;
    align-items: center!important;
    gap: 5px;
    border-bottom: 2px solid #5db068;
    color: #059200;
    background: rgb(255, 255, 255);
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: #1e293b33 0px 2px 4px;
    text-decoration: none;
    font-size: 1.1em;
    
    font-weight: 700;
    transition: all 0.2s;
}

.btn-outline:hover {
    background: #56c977;
    border-bottom: 2px solid #509c5a;
    color: white;
    box-shadow: 0 2px 4px rgba(8, 11, 16, 0.35);
}

.btn-raw {
    display: flex;
    align-items: center;
    gap: 5px;
    border-bottom: 2px solid #2c82c9;
    color: #1565c0;
    background: #ffffff;
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: #1e293b33 0px 2px 4px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    margin-left: 10px; /* ให้มีช่องไฟจากปุ่มแรก */
}

.btn-raw:hover {
    background: #3ea0e0;
    border-bottom: 2px solid #2e73aa;
    color: white;
    box-shadow: 0 2px 4px rgba(8, 11, 16, 0.35);
}

/* --- Stats Section (Layout: Label Top / Row Bottom) --- */
.stats-container {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    margin-bottom: 15px;
}

.stat-box {
    display: flex;
    flex-direction: column;
    /* เรียงแนวตั้ง: เอา label ไว้บน */
    align-items: flex-start;
    /* ชิดซ้าย */
    justify-content: center;
    padding: 12px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    transition: transform 0.2s;
}

.stat-box:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

/* จัดการ Label */
.stat-box small {
    color: #64748b;
    font-size: 0.7rem;
    font-weight: 600;
    margin-bottom: 8px;
    /* เว้นระยะห่างจากตัวเลข */
    white-space: nowrap;
}

/* จัดกลุ่ม Emoji + ตัวเลข ให้อยู่บรรทัดเดียวกัน */
.stat-value-row {
    display: flex;
    align-items: center;
    gap: 8px;
    /* ระยะห่างระหว่าง Emoji กับเลข */
    width: 100%;
}

/* Style Emoji Icon */
.stat-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

/* Style ตัวเลข */
.stat-value-row h3 {
    margin: 0;
    font-size: 1.4rem;
    color: #1e293b;
    line-height: 1;
}

/* สีแยกแต่ละ Theme */
.stat-box.work .stat-icon {
    background: #dbeafe;
    color: #2563eb;
}

.stat-box.late .stat-icon {
    background: #fee2e2;
    color: #dc2626;
}

.stat-box.leave .stat-icon {
    background: #ffedd5;
    color: #c2410c;
}

/*ป้ายวันหยุด*/

/* ป้ายกรณีลาหยุด */
.leave-badge {
    display: inline-block;
    margin-left: 8px;
    background: #ff7878;
    color: #ffffff;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
}

/* แถวสำหรับลาหยุด */
.leave-row {
    background-color: #ffe9e9;
    opacity: 0.95;
}


/* ป้ายวันหยุดปกติ */
.day-off-badge {
    display: inline-block;
    margin-left: 8px;
    background: #b3becc;
    color: #ffffff;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
}

/* ป้ายกรณีทำงานในวันหยุด (เด่นกว่า) */
.day-work-badge {
    display: inline-block;
    margin-left: 8px;
    background: #ffb65d;
    color: #ffffff;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 800;
    border: 1px solid rgba(180, 83, 9, 0.12);
}

/* แถวสำหรับวันหยุดปกติ (existing) */
.day-off-row {
    background-color: #eaf9ff;
    opacity: 0.95;
}

/* แถวสำหรับกรณีทำงานวันหยุด - เน้นด้วยสีอุ่น */
.day-work-row {
    background-color: #fdffde;
    box-shadow: inset 0 0 0 1px rgba(217, 115, 14, 0.06);
}

/* ...existing code... */
/* กล่องรวมปุ่ม */
.filter-container {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
}

/* ปุ่มพื้นฐาน */
.filter-btn {
    padding: 4px 16px;
    border-radius: 8px;
    border: none;
    border-bottom: #d6d6d6 2px solid;
    background: #f1f5f9;
    /* slate-100 */
    color: #334155;
    /* slate-700 */
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: 500;
    transition: 0.18s ease;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.06);
}

/* hover สวยๆ */
.filter-btn:hover {
    background: #e2e8f0;
    /* slate-200 */
    transform: translateY(-1px);
}

/* ACTIVE = โหมดที่ถูกเลือก */
.filter-btn.active {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border-bottom: #555eaf 2px solid;
    /* ฟ้าเข้ม gradient */
    color: white;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
    transform: translateY(-1px);
}

/* เมื่อ active แล้ว hover ก็ให้เล่นนิดเดียว */
.filter-btn.active:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
}



/* CSS สำหรับ Login ที่เพิ่มเข้ามา */

.login-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f8fafc;
}

.login-card {
    
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-card h2 {
    margin-bottom: 25px;
    color: #1e293b;
}

.login-card input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    box-sizing: border-box;
}

.login-card button {
    width: 100%;
    padding: 12px;
    background-color: #0077ff;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

.login-card button:hover {
    background-color: #1358c0;
}

.error-message {
    color: #ef4444;
    margin-top: 15px;
    display: none;
    font-size: 0.9rem;
}

/* ซ่อน Sidebar และปรับ Layout หลัก */
.sidebar {
    display: none;
}

.main-content {
    margin-left: 0px !important;
    width: 100% !important;
}

/* ----------------------------------- */
/* CSS สำหรับ Progress Bar (Google Style) */
/* ----------------------------------- */
.progress-bar-container {
    width: 100%;
    height: 4px;
    background-color: #c9c9c9;
    overflow: hidden;
    border-radius: 2px;
    margin-bottom: 20px;
    margin-top: -10px;
    /* 💡 [สำคัญ] ต้องมี position: relative เพื่อให้แถบวิ่งภายในได้ */
    position: relative;
}

.progress-bar-indicator {
    height: 100%;
    background: linear-gradient(135deg, #ffffff, #0084ff);
    animation: indeterminate-bar 1.6s infinite cubic-bezier(0.8, 0.3, 0.2, 0.7);
    /* 💡 [สำคัญ] ต้องมี position: absolute เพื่อให้ใช้ left/right ใน Keyframes ได้ */
    position: absolute;
}

/* ⚙️ Keyframes: กำหนดรูปแบบการวิ่ง */
@keyframes indeterminate-bar {
    0% {
        /* เริ่มต้น: แถบจะอยู่ทางซ้ายสุดและสั้น */
        left: -35%;
        right: 100%;
    }

    60% {
        /* จุดที่แถบยืดออกจนสุดและเคลื่อนที่ไปทางขวา */
        left: -90%;
        right: -20%;
    }

    100% {
        /* สิ้นสุด: แถบหดกลับไปทางซ้ายสุดเพื่อเริ่มใหม่อีกครั้ง */
        left: 100%;
        right: -35%;
    }
}

/* =========================================
   4. MOBILE RESPONSIVE (มือถือ)
   ========================================= */
@media (max-width: 768px) {

         .main-filter > div {
        display: flex !important;
        flex-wrap: wrap !important;
    }

    /* 👇 ของสองอันนี้อยู่แถวบน */
    #viewMode,
    #sortMode {
        width: 48% !important;
        max-width: none !important;
    }

    /* 👇 ของวัน/เดือนลงแถวใหม่ */
    #filterDate,
    #filterMonth {
        width: 100% !important;
        max-width: none !important;
        margin-top: 6px;
    }
}

    .header-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .summary-badges {
        width: 100%;
        justify-content: space-between;
        margin-top: 10px;
    }

    .badge-stat {
        flex: 1;
        justify-content: center;
        font-size: 12px;
    }
}