  :root {
      --primary:        #1E3A8A;
      --primary-light:  #3B82F6;
      --primary-pale:   #DBEAFE;
      --secondary:      #1E3A8A;
      --secondary-light:#60A5FA;
      --navy:           #1E3A8A;
      --navy-light:     #1E40AF;
      --maroon:         #7B0000;
      --slate:          #64748B;
      --white:          #FFFFFF;
      --bg:             #FFFFFF;
      --bg-light:       #F9FAFB;
      --surface:        #FFFFFF;
      --surface-hover:  #F3F4F6;
      --text-primary:   #111827;
      --text-secondary: #4B5563;
      --border:         #E5E7EB;
      --success:        #059669;
      --success-light:  #D1FAE5;
      --warning:        #D97706;
      --warning-light:  #FEF3C7;
      --danger:         #DC2626;
      --danger-light:   #FEE2E2;
      --info:           #0284C7;
      --info-light:     #CFF0FF;
  }
  
  * { box-sizing: border-box; margin: 0; padding: 0; }
  
  /* เพิ่ม overflow-x: hidden เพื่อป้องกันหน้าจอเลื่อนซ้ายขวาบนมือถือ */
  body { font-family: 'Prompt', sans-serif; background: var(--bg-light); color: var(--text-primary); min-height: 100vh; font-size: 16px; line-height: 1.6; overflow-x: hidden; }
  
  ::-webkit-scrollbar { width: 8px; height: 8px; }
  ::-webkit-scrollbar-track { background: var(--bg-light); }
  ::-webkit-scrollbar-thumb { background: var(--primary-light); border-radius: 10px; }
  ::-webkit-scrollbar-thumb:hover { background: var(--primary); }

  .topbar { background: var(--primary); position: sticky; top: 0; z-index: 40; box-shadow: 0 4px 12px rgba(30,58,138,0.12); border-bottom: 3px solid var(--primary-light); }
  .topbar-inner { max-width: 1280px; margin: 0 auto; padding: 0 2rem; height: 70px; display: flex; align-items: center; justify-content: space-between; }
  .brand { display: flex; align-items: center; gap: 14px; }
  .brand-icon { width: 44px; height: 44px; background: var(--primary-light); border-radius: 12px; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(30,58,138,0.2); flex-shrink: 0; }
  .brand-icon .material-icons { color: #fff; font-size: 24px; }
  
  /* ใช้ clamp เพื่อให้ฟอนต์ปรับขนาดเองบนจอมือถือ */
  .brand-name { color: #fff; font-size: clamp(1.1rem, 4vw, 1.35rem); font-weight: 700; letter-spacing: 0.02em; }
  .brand-sub { color: var(--primary-pale); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.15em; text-transform: uppercase; display: block; margin-top: -2px; }
  
  .btn-admin { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.3); color: #fff; border-radius: 8px; font-family: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: all 0.2s; width: auto; white-space: nowrap; }
  .btn-admin:hover { background: rgba(255,255,255,0.3); border-color: rgba(255,255,255,0.5); }

  .hero { background: var(--primary); padding: 4rem 2rem 5.5rem; position: relative; overflow: hidden; }
  .hero::before { content: ''; position: absolute; inset: 0; background: url('https://www.transparenttextures.com/patterns/cubes.png'); opacity: 0.03; }
  .hero-inner { max-width: 1280px; margin: 0 auto; position: relative; text-align: center; }
  .hero-eyebrow { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.25); padding: 8px 18px; border-radius: 30px; color: #fff; font-size: 0.8rem; font-weight: 600; margin-bottom: 1rem; }
  .hero-title { color: #fff; font-size: clamp(1.8rem, 5vw, 2.75rem); font-weight: 800; line-height: 1.15; text-shadow: 0 2px 8px rgba(0,0,0,0.15); letter-spacing: -0.01em; }
  .hero-desc { color: rgba(255,255,255,0.9); font-size: clamp(0.95rem, 3vw, 1.1rem); margin-top: 12px; font-weight: 500; line-height: 1.7; }
  
  .search-float { max-width: 800px; margin: 0 auto; padding: 0 1rem; margin-top: -28px; position: relative; z-index: 10; }
  .search-box { background: var(--surface); border-radius: 12px; display: flex; align-items: center; gap: 12px; padding: 14px 24px; box-shadow: 0 8px 24px rgba(30,58,138,0.12); border: 1px solid var(--border); width: 100%; }
  .search-box .material-icons { color: var(--primary); font-size: 24px; flex-shrink: 0; }
  .search-box input { flex: 1; border: none; outline: none; font-family: inherit; font-size: 1rem; color: var(--text-primary); background: transparent; font-weight: 500; min-width: 0; }
  .search-box input::placeholder { color: var(--text-secondary); }

  .section-wrap { max-width: 1280px; margin: 0 auto; padding: 3rem 2rem; }
  .section-header { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 2rem; }
  .section-rule { width: 6px; height: 28px; background: var(--primary); border-radius: 4px; }
  .section-title { font-size: clamp(1.25rem, 4vw, 1.5rem); font-weight: 800; color: var(--text-primary); letter-spacing: -0.01em; }
  .section-count { margin-left: auto; background: var(--bg-light); padding: 8px 16px; border-radius: 20px; font-size: 0.9rem; color: var(--primary); font-weight: 700; border: 1px solid var(--border); }
  
  /* ป้องกัน Grid แตกบนหน้าจอที่เล็กกว่า 320px */
  .rooms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 1.5rem; }
  .room-card { background: var(--surface); border-radius: 16px; overflow: hidden; border: 1px solid var(--border); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); display: flex; flex-direction: column; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
  .room-card:hover { box-shadow: 0 16px 32px rgba(30,58,138,0.12); transform: translateY(-6px); border-color: var(--primary-light); }
  .room-card-img { width: 100%; height: 180px; object-fit: cover; display: block; border-bottom: 3px solid var(--primary); }
  .room-card-img-placeholder { width: 100%; height: 180px; background: var(--primary); display: flex; align-items: center; justify-content: center; border-bottom: 3px solid var(--primary); }
  .room-card-img-placeholder .material-icons { font-size: 64px; color: rgba(255,255,255,0.25); }
  .room-card-content { padding: 1.5rem; flex: 1; display: flex; flex-direction: column; }
  .room-header-flex { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 1rem; }
  .room-name { color: var(--text-primary); font-size: 1.2rem; font-weight: 700; line-height: 1.3; word-break: break-word; }
  .room-badge { font-size: 0.75rem; font-weight: 700; padding: 6px 12px; border-radius: 20px; white-space: nowrap; flex-shrink: 0; }
  .badge-available { background: var(--success-light); color: var(--success); border: 1px solid rgba(5,150,105,0.3); }
  .badge-unavailable { background: var(--danger-light); color: var(--danger); border: 1px solid rgba(220,38,38,0.3); }
  .room-card-footer { padding: 0 1.5rem 1.5rem; display: flex; gap: 8px; flex-wrap: wrap; }
  
  .btn-book, .btn-outline, .btn-unavailable { flex: 1; min-width: 120px; padding: 13px; border-radius: 8px; font-family: inherit; font-size: 0.95rem; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 6px; transition: all 0.2s; cursor: pointer; text-align: center; }
  .btn-book { background: var(--primary); color: #fff; border: none; box-shadow: 0 4px 12px rgba(30,58,138,0.2); }
  .btn-book:hover { background: var(--primary-light); transform: translateY(-2px); box-shadow: 0 6px 16px rgba(30,58,138,0.25); }
  .btn-outline { background: var(--bg-light); color: var(--primary); border: 1.5px solid var(--primary); }
  .btn-outline:hover { background: var(--primary-pale); }
  .btn-unavailable { background: #F5F5F5; color: #9CA3AF; border: 1px solid #E5E7EB; cursor: not-allowed; }
  
  .chip { display: inline-block; padding: 6px 12px; border-radius: 20px; font-size: 0.8rem; font-weight: 700; text-transform: uppercase; white-space: nowrap; }
  .chip-pending { background: var(--warning-light); color: var(--warning); border: 1px solid rgba(217,119,6,0.3); }
  .chip-approved { background: var(--success-light); color: var(--success); border: 1px solid rgba(5,150,105,0.3); }
  .chip-busy { background: var(--danger-light); color: var(--danger); border: 1px solid rgba(220,38,38,0.3); }

  .admin-topbar { background: var(--primary); border-radius: 16px; padding: 2rem; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin-bottom: 2rem; box-shadow: 0 4px 16px rgba(30,58,138,0.12); border-left: 5px solid var(--primary-light); }
  .admin-topbar-left { display: flex; align-items: center; gap: 16px; }
  .admin-av { width: 56px; height: 56px; background: var(--primary-light); border: 1px solid var(--primary-light); border-radius: 14px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 1.2rem; flex-shrink: 0; }
  .admin-title { color: #fff; font-size: clamp(1.2rem, 3vw, 1.4rem); font-weight: 700; }
  .admin-sub { color: rgba(255,255,255,0.8); font-size: 0.9rem; margin-top: 4px; font-weight: 500; }
  
  /* ทำให้แท็บเลื่อนได้บนมือถือโดยไม่ตกบรรทัด */
  .tab-nav { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 8px; margin-bottom: 2rem; -webkit-overflow-scrolling: touch; }
  .tab-nav::-webkit-scrollbar { display: none; } /* ซ่อน scrollbar สำหรับแท็บ */
  .tab-btn { padding: 10px 24px; border-radius: 8px; font-family: inherit; font-size: 0.95rem; font-weight: 600; cursor: pointer; border: none; transition: all 0.2s; background: transparent; color: var(--text-secondary); white-space: nowrap; }
  .tab-btn.active { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(30,58,138,0.2); }
  .tab-btn:hover:not(.active) { background: var(--bg-light); color: var(--text-primary); }
  
  /* ป้องกันตารางพังบนมือถือ ให้เลื่อนซ้ายขวาได้ */
  .data-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow-x: auto; margin-bottom: 2rem; box-shadow: 0 2px 8px rgba(0,0,0,0.04); -webkit-overflow-scrolling: touch; }
  .form-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 2rem; margin-bottom: 1.5rem; overflow-x: hidden; }
  .data-table { width: 100%; border-collapse: collapse; min-width: 700px; /* บังคับความกว้างขั้นต่ำไม่ให้คอลัมน์บีบกัน */ }
  .data-table thead tr { background: var(--bg-light); border-bottom: 2px solid var(--border); }
  .data-table th { padding: 16px 24px; text-align: left; font-size: 0.9rem; font-weight: 700; color: var(--text-primary); white-space: nowrap; }
  .data-table td { padding: 16px 24px; border-bottom: 1px solid var(--border); vertical-align: middle; font-size: 0.95rem; }
  .data-table tbody tr:hover { background: var(--bg-light); }
  .td-name { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
  .td-sub { font-size: 0.85rem; color: var(--text-secondary); margin-top: 4px; display: flex; align-items: center; gap: 4px; }
  
  .act-btn { width: 36px; height: 36px; border-radius: 8px; border: none; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; box-shadow: 0 2px 4px rgba(0,0,0,0.05); margin-right: 4px; flex-shrink: 0; }
  .act-primary { background: var(--info-light); color: var(--info); border: 1px solid rgba(2,132,199,0.3); } .act-primary:hover { background: var(--info); color: #fff; }
  .act-approve { background: var(--success-light); color: var(--success); border: 1px solid rgba(5,150,105,0.3); } .act-approve:hover { background: var(--success); color: #fff; }
  .act-reject { background: var(--danger-light); color: var(--danger); border: 1px solid rgba(220,38,38,0.3); }  .act-reject:hover { background: var(--danger); color: #fff; }
  .act-delete { background: var(--danger-light); color: var(--danger); border: 1px solid rgba(220,38,38,0.3); }  .act-delete:hover { background: var(--danger); color: #fff; }

  .f-label { font-size: 0.9rem; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; display: block; }
  .f-input { width: 100%; padding: 12px 16px; border: 1.5px solid var(--border); border-radius: 8px; font-family: inherit; font-size: 0.95rem; background: var(--surface); outline: none; transition: all 0.2s; color: var(--text-primary); font-weight: 500; }
  .f-input::placeholder { color: var(--text-secondary); }
  .f-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30,58,138,0.08); }
  
  .modal-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  
  .time-wrap { display: flex; align-items: center; background: var(--surface); border: 1.5px solid var(--border); border-radius: 8px; padding: 0 12px; transition: all 0.2s; }
  .time-wrap:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30,58,138,0.08); }
  .time-select { flex: 1; text-align: center; background: transparent; border: none; outline: none; font-family: inherit; font-size: 1.05rem; font-weight: 600; color: var(--text-primary); cursor: pointer; padding: 10px 0; appearance: none; }

  .btn-submit { width: 100%; padding: 14px; background: var(--primary); color: #fff; border: none; border-radius: 8px; font-family: inherit; font-size: 1rem; font-weight: 700; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; justify-content: center; gap: 8px; box-shadow: 0 4px 12px rgba(30,58,138,0.2); }
  .btn-submit:hover { background: var(--primary-light); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(30,58,138,0.25); }
  .btn-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

  .btn-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; border-radius: 8px; padding: 12px 14px; font-family: inherit; font-size: 0.95rem; font-weight: 700; cursor: pointer; transition: all 0.2s; }
  .btn-danger:hover { background: #fecaca; color: #7f1d1d; }

  #adminUsersModal .modal-box { max-width: 960px; }
  #adminUsersModal .modal-body { display: grid; grid-template-columns: 1.2fr 0.9fr; gap: 20px; padding: 1.8rem; }
  #adminUsersModal .modal-body > div { min-width: 0; }
  #adminUsersModal .modal-body .data-table { min-width: auto; }
  #adminUsersModal .modal-body table { width: 100%; }
  
  /* Audit Log Modal - Desktop Default */
  #toggleFilterBtn {
    display: none !important;
  }
  
  #auditFilterContent {
    display: flex !important;
  }
  
  #auditFilterContent.show {
    display: flex !important;
  }
  #adminUsersModal .modal-body .btn-submit, #adminUsersModal .modal-body .btn-outline, #adminUsersModal .modal-body .btn-danger { min-width: 0; }

  .overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(4px); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 1rem; }
  .modal-box { background: var(--surface); border-radius: 20px; width: 100%; max-width: 600px; box-shadow: 0 20px 40px rgba(0,0,0,0.15); animation: scaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1); display: flex; flex-direction: column; max-height: 90vh; border: 1px solid var(--border); margin: auto; }
  @keyframes scaleIn { from { opacity:0; transform:scale(0.95) translateY(10px); } to { opacity:1; transform:scale(1) translateY(0); } }
  .modal-head { background: var(--surface); padding: 1.5rem 2rem; position: relative; border-bottom: 2px solid var(--border); flex-shrink: 0; border-radius: 20px 20px 0 0; }
  .modal-head-title { color: var(--text-primary); font-size: 1.35rem; font-weight: 800; padding-right: 2rem; }
  .modal-head-sub { color: var(--text-secondary); font-size: 0.9rem; margin-top: 6px; font-weight: 500; }
  .modal-close { position: absolute; top: 1.5rem; right: 1.5rem; background: var(--bg-light); border: none; width: 32px; height: 32px; border-radius: 50%; color: var(--text-secondary); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; border: 1px solid var(--border); font-weight: 700; z-index: 2;}
  .modal-close:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
  .modal-body { padding: 2rem; overflow-y: auto; flex: 1; border-radius: 0 0 20px 20px; }
  
  .empty-td { padding: 4rem 2rem; text-align: center; color: var(--text-secondary); font-size: 1rem; font-weight: 500; }
  .spinner { width: 40px; height: 40px; border: 4px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s ease-in-out infinite; margin: 0 auto 16px; }
  @keyframes spin { to { transform: rotate(360deg); } }
  .hidden { display: none !important; }

  /* แก้ไข Toast Notification ไม่ให้ทะลุจอ */
  #toastContainer { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; pointer-events: none; max-width: calc(100% - 40px); }
  .toast { padding: 14px 20px; border-radius: 8px; font-weight: 600; font-size: 0.95rem; display: flex; align-items: center; gap: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.12); animation: slideLeft 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards; transition: opacity 0.3s; pointer-events: auto; background: var(--surface); border-left: 5px solid; border-top: 1px solid var(--border); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); word-break: break-word; }
  .toast-success { color: var(--success); border-left-color: var(--success); }
  .toast-error { color: var(--danger); border-left-color: var(--danger); }
  .toast-info { color: var(--info); border-left-color: var(--info); }
  @keyframes slideLeft { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

  .admin-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; margin-top:1rem; }
  .admin-gallery-item { position: relative; border-radius: 10px; overflow: hidden; aspect-ratio: 4/3; background: var(--bg-light); border: 1px solid var(--border); transition: all 0.2s; }
  .admin-gallery-item:hover { border-color: var(--primary); }
  .admin-gallery-item img { width: 100%; height: 100%; object-fit: cover; }
  .admin-gallery-del { position: absolute; top: 6px; right: 6px; background: var(--danger); color: #fff; border: none; border-radius: 50%; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,0.15); transition: transform 0.2s; }
  .admin-gallery-del:hover { transform: scale(1.1); background: var(--danger); }

  #landingMenuSection { animation: fadeIn 0.3s ease-out; display: flex; flex-wrap: wrap; gap: 24px; justify-content: center; }
  .menu-card { background: var(--surface); border-radius: 20px; padding: 40px 30px; text-align: center; cursor: pointer; transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1); box-shadow: 0 10px 30px rgba(30,58,138,0.08); flex: 1; min-width: 260px; max-width: 450px; border: 2px solid transparent; }
  .menu-card:hover { transform: translateY(-8px); border-color: var(--primary); box-shadow: 0 20px 40px rgba(30,58,138,0.15); }
  .menu-card-icon { width: 90px; height: 90px; background: var(--primary-pale); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 24px; color: var(--primary); transition: all 0.3s; }
  .menu-card .material-icons { font-size: 44px; }
  .menu-card:hover .menu-card-icon { background: var(--primary); color: #fff; transform: scale(1.1); }
  @keyframes fadeIn { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }

  .mvc-footer { background-color: #1e293b; color: #94a3b8; padding: 3.5rem 2rem 1.5rem; margin-top: 4rem; font-family: inherit; position: relative; }
  .footer-container { max-width: 1280px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 2.5rem; margin-bottom: 3rem; }
  .footer-brand .f-logo { color: #ffffff; font-size: 1.25rem; font-weight: 700; display: flex; align-items: center; gap: 10px; margin-bottom: 1rem; }
  .footer-brand .f-logo .material-icons { color: #38bdf8; font-size: 28px; }
  .footer-brand p { line-height: 1.6; font-size: 0.9rem; margin: 0 0 1.5rem 0; }
  .btn-main-site { display: inline-flex; align-items: center; gap: 8px; background: rgba(56, 189, 248, 0.1); color: #38bdf8; padding: 8px 16px; border-radius: 6px; text-decoration: none; font-size: 0.85rem; font-weight: 600; border: 1px solid rgba(56, 189, 248, 0.3); transition: all 0.2s ease; }
  .btn-main-site:hover { background: #38bdf8; color: #1e293b; }
  .footer-section h4 { color: #ffffff; font-size: 1.05rem; font-weight: 600; margin-top: 0; margin-bottom: 1.25rem; }
  .footer-section ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.85rem; }
  .footer-section ul li a, .footer-section ul li span.interactive { color: #94a3b8; text-decoration: none; transition: color 0.2s ease; font-size: 0.9rem; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
  .footer-section ul li a:hover, .footer-section ul li span.interactive:hover { color: #38bdf8; transform: translateX(4px); }
  .footer-section ul li.contact-item { display: flex; align-items: flex-start; gap: 10px; font-size: 0.9rem; line-height: 1.5; }
  .footer-section ul li.contact-item .material-icons { font-size: 18px; color: #64748b; margin-top: 2px; }
  .footer-bottom { max-width: 1280px; margin: 0 auto; padding-top: 1.5rem; border-top: 1px solid #334155; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; font-size: 0.85rem; }
  .footer-legal { display: flex; flex-wrap: wrap; gap: 1.5rem; }
  .footer-legal a { color: #94a3b8; text-decoration: none; transition: 0.2s; cursor: pointer; }
  .footer-legal a:hover { color: #ffffff; }

  .floating-feedback-btn { position: fixed; bottom: 30px; right: 30px; background: linear-gradient(135deg, #38bdf8, #0284c7); color: white; width: 56px; height: 56px; border-radius: 50%; display: flex; justify-content: center; align-items: center; box-shadow: 0 4px 12px rgba(2, 132, 199, 0.4); cursor: pointer; transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); z-index: 9999; }
  .floating-feedback-btn:hover { transform: scale(1.1) rotate(5deg); box-shadow: 0 6px 16px rgba(2, 132, 199, 0.6); }
  .floating-feedback-btn .material-icons { font-size: 26px; }

  .fb-modal-overlay, .custom-alert-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(4px); z-index: 10000; display: flex; justify-content: center; align-items: center; opacity: 0; pointer-events: none; transition: 0.3s; padding: 1rem; }
  .fb-modal-overlay.active, .custom-alert-overlay.active { opacity: 1; pointer-events: auto; }
  .fb-modal-box, .custom-alert-box { background: #ffffff; width: 100%; max-width: 450px; border-radius: 12px; padding: 24px; box-shadow: 0 10px 25px rgba(0,0,0,0.1); transform: translateY(20px); transition: 0.3s; margin: auto; }
  .fb-modal-overlay.active .fb-modal-box, .custom-alert-overlay.active .custom-alert-box { transform: translateY(0); }
  .fb-input { width: 100%; padding: 10px 12px; margin-bottom: 15px; border-radius: 6px; border: 1px solid #cbd5e1; font-family: inherit; box-sizing: border-box; }
  .custom-alert-box { text-align: center; }

  /* ========================================== */
  /* 📱 ชุดคำสั่ง Media Queries จัดการหน้าจอมือถือ (Mobile Responsive) */
  /* ========================================== */
  
  @media (max-width: 768px) {
    /* ปรับแต่ง Topbar และเนื้อหาหลัก */
    .topbar-inner { padding: 0 1rem; }
    .section-wrap { padding: 2rem 1rem; }
    
    /* จัดการ Form สองคอลัมน์ให้เหลือคอลัมน์เดียว */
    .modal-2col, #adminUsersModal .modal-body { grid-template-columns: 1fr; }
    #adminUsersModal .modal-body { padding: 1.2rem; gap: 16px; }
    .modal-box { max-height: 95vh; width: 100%; max-width: 95%; }
    .modal-head { padding: 1rem 1.25rem; }
    .modal-body { padding: 1.25rem; overflow-y: auto; }
    
    /* ปรับ publicStatusModal responsive */
    #publicStatusModal .modal-box { 
      max-width: 95% !important; 
      width: 100% !important; 
      height: auto !important; 
      max-height: 85vh !important; 
    }
    #publicStatusModal .modal-body { padding: 1rem; }
    #pubZoneStatus, #pubZoneSchedule { overflow-y: auto; }
    
    /* ปรับตาราและค้นหา */
    #auditLogModal .modal-box { width: 95% !important; max-width: 95% !important; }
    table { font-size: 0.8rem; }
    table th, table td { padding: 8px 6px; }
    
    /* ปรับปุ่มค้นหา */
    .search-float { padding: 0 1rem; margin-top: -20px; }
    .search-box { padding: 10px 16px; }
    
    /* ปรับแบนเนอร์แอดมิน */
    .admin-topbar { flex-direction: column; text-align: center; justify-content: center; padding: 1.5rem; }
    .admin-topbar-left { flex-direction: column; gap: 8px; }
    
    /* Footer และปุ่มลอย */
    .mvc-footer { padding: 2.5rem 1.5rem 1.5rem; }
    .footer-bottom { flex-direction: column; text-align: center; justify-content: center; }
    .footer-legal { justify-content: center; }
    .floating-feedback-btn { bottom: 20px; right: 20px; width: 50px; height: 50px; }
    
    /* ลด Padding ของแบบฟอร์ม */
    .form-card { padding: 1.25rem; }
    
    #adminUsersModal .modal-body > div { width: 100%; }
    #adminUsersModal .modal-body .data-table { min-width: auto; }
    #adminUsersModal .modal-body .btn-submit, #adminUsersModal .modal-body .btn-outline, #adminUsersModal .modal-body .btn-danger { width: 100%; }
    
    /* PublicStatusModal compact */
    #publicStatusModal .modal-box {
      max-width: 95% !important;
      width: 95% !important;
      height: auto !important;
      max-height: 80vh !important;
    }
    
    #publicStatusModal .modal-head {
      padding: 8px 10px !important;
    }
    
    #publicStatusModal .modal-body {
      padding: 8px 8px !important;
    }
  }

  @media (max-width: 480px) {
    /* ซ่อนคำบรรยายโลโก้ในจอเล็กมากๆ เพื่อป้องกันการเบียด */
    .brand-sub { display: none; }
    .brand-name { font-size: 1.1rem; }
    
    /* ปรับปุ่มให้กะทัดรัดขึ้น */
    .btn-admin { padding: 6px 10px; font-size: 0.8rem; gap: 5px; }
    .act-btn { width: 32px; height: 32px; }
    
    /* ปรับ .rs ให้ซ่อนข้อความแต่แสดงไอคอน */
    .rs {
      font-size: 0; /* ซ่อนตัวหนังสือ */
      width: 32px;  /* (แนะนำ) ปรับจาก 5px ให้พอดีกับขนาดไอคอน */
      height: 32px;
      display: inline-flex;
      justify-content: center;
      align-items: center;
    }

    /* คืนค่าขนาดให้ไอคอน (สมมติว่าไอคอนใช้แท็ก <i> หรือ <svg>) */
    .rs i, .rs svg {
      font-size: 16px; /* กำหนดขนาดไอคอนให้กลับมามองเห็น (ปรับแต่งได้) */
    }
    
    /* ========== ปรับ Modal ให้ full-width บน mobile ========== */
    .modal-box { 
      width: 100% !important; 
      max-width: 100% !important; 
      max-height: 100vh !important;
      border-radius: 16px 16px 0 0 !important;
      margin-bottom: 0 !important;
      position: fixed !important;
      bottom: 0 !important;
      left: 0 !important;
      right: 0 !important;
      top: auto !important;
    }
    
    /* ปรับ publicStatusModal ให้ bottom sheet */
    #publicStatusModal .modal-box {
      max-width: 100% !important;
      width: 100% !important;
      max-height: 95vh !important;
      height: auto !important;
      border-radius: 20px 20px 0 0 !important;
    }
    
    #publicStatusModal .modal-head {
      padding: 16px !important;
    }
    
    #publicStatusModal .modal-body {
      padding: 12px 16px !important;
      max-height: calc(95vh - 120px) !important;
      overflow-y: auto !important;
    }
    
    /* ปรับแท็บให้ fit */
    #publicStatusModal .modal-head > div:nth-child(2) {
      display: flex;
      margin-top: 12px;
      flex-wrap: wrap;
      gap: 4px;
    }
    
    #tabPubSchedule, #tabPubStatus {
      flex: 1;
      padding: 10px 8px !important;
      font-size: 0.8rem !important;
      font-weight: 600 !important;
    }
    
    /* ปรับ input/select ให้เต็มจอ และ compact */
    .f-input, .f-label {
      font-size: 13px !important;
    }
    
    .f-label {
      margin-bottom: 3px !important;
    }
    
    .f-input {
      width: 100% !important;
      padding: 6px 8px !important;
      border-radius: 6px !important;
    }
    
    #pub_check_date, #pub_search_phone {
      width: 100% !important;
      padding: 6px 8px !important;
      font-size: 0.85rem !important;
    }
    
    /* ปรับ search box/input group ให้ compact */
    #pubZoneSchedule > div:first-child,
    #pubZoneStatus > div:first-child {
      margin-bottom: 6px !important;
      padding: 6px 8px !important;
    }
    
    /* ปรับ search button compact */
    .btn-submit {
      padding: 6px 10px !important;
      font-size: 0.8rem !important;
      gap: 4px !important;
      height: auto !important;
    }
    
    .btn-submit .material-icons {
      font-size: 16px !important;
    }
    
    /* ทำให้ modal status/schedule result ใช้พื้นที่เต็มที่ */
    #pubScheduleResult, #pubStatusResult {
      gap: 4px !important;
    }
    
    #pubZoneSchedule, #pubZoneStatus {
      display: flex;
      flex-direction: column;
      height: 100%;
    }
    
    #pubStatusResult > div:first-child {
      flex-shrink: 0;
    }
    
    /* ปรับ table ให้ scroll */
    #auditLogModal table {
      font-size: 0.8rem !important;
      table-layout: fixed !important;
      width: 100% !important;
    }
    
    #auditLogModal table th,
    #auditLogModal table td {
      padding: 8px 10px !important;
      word-wrap: break-word;
      word-break: break-word;
      overflow-wrap: break-word;
    }
    
    #auditLogModal table th {
      background: var(--navy) !important;
      color: white !important;
      font-weight: 700 !important;
      font-size: 0.8rem !important;
    }
    
    #auditLogModal table tbody tr {
      border-bottom: 1px solid #E2E8F0;
    }
    
    #auditLogModal table tbody tr:hover {
      background: #F1F5F9 !important;
    }
    
    /* Audit Log Modal - Responsive Filter */
    #toggleFilterBtn {
      display: flex !important;
      padding: 8px 10px !important;
      background: #F8FAFC !important;
    }
    
    #auditFilterContent {
      display: none !important;
      flex-wrap: wrap;
      gap: 6px;
      padding: 8px !important;
    }
    
    #auditFilterContent.show {
      display: flex !important;
    }
    
    #auditLogModal .modal-body table {
      font-size: 0.75rem !important;
      table-layout: fixed !important;
      width: 100% !important;
    }
    
    #auditLogModal .modal-body table th,
    #auditLogModal .modal-body table td {
      padding: 6px 8px !important;
      word-wrap: break-word;
      word-break: break-word;
      overflow-wrap: break-word;
    }
    
    #auditFilterContent.show {
      display: flex !important;
      flex-wrap: wrap;
      gap: 6px;
      padding: 8px !important;
    }
    
    #auditLogModal .modal-body table {
      font-size: 0.8rem !important;
      min-width: 850px;
    }
    
    #auditLogModal .modal-body table th,
    #auditLogModal .modal-body table td {
      padding: 8px 10px !important;
    }
    
    #auditLogModal .modal-head {
      padding: 12px 12px !important;
    }
    
    #toggleFilterBtn {
      display: none !important;
    }
    
    #auditFilterContent {
      display: flex !important;
    }
  }
    
    
    /* ปรับ modal heading responsive */
    .modal-head-title {
      font-size: 1rem !important;
      flex-wrap: wrap;
      gap: 4px !important;
    }
    
    .modal-head {
      padding: 10px 12px !important;
    }
    
    .modal-body {
      padding: 10px 10px !important;
    }
    
    /* ปรับปุ่มปิด modal */
    .modal-close {
      width: 26px !important;
      height: 26px !important;
    }
    
    .modal-close .material-icons {
      font-size: 16px !important;
    }
    
    /* ปรับ audit modal */
    #auditLogModal .modal-box {
      width: 100% !important;
      max-width: 100% !important;
      max-height: 95vh !important;
      height: 100vh !important;
    }
    
    #auditLogModal .modal-head {
      flex-direction: column !important;
      align-items: flex-start !important;
      padding: 12px !important;
    }
    
    #auditLogModal .modal-head-title {
      font-size: 0.95rem !important;
      flex-direction: row;
    }
    
    #auditLogModal .modal-head-title .material-icons {
      font-size: 24px !important;
      padding: 6px !important;
    }
    
    #auditLogModal .modal-head-title div {
      font-size: 0.85rem !important;
    }
    
    /* ปรับ filter bar */
    #auditLogModal .modal-body {
      padding: 0;
    }
    @media (max-width: 768px) {
  /* 1. ส่วนหัว: เปลี่ยนจากเรียงแนวนอนเป็นแนวตั้ง (บนลงล่าง) */
  #auditLogModal .modal-head {
    flex-direction: column !important;
    padding: 20px 15px !important;
  }
  
  #auditLogModal .modal-head-title {
    max-width: 100% !important;
    margin-bottom: 15px !important;
  }

  /* 2. ปุ่ม Print: จัดให้กินพื้นที่เต็มความกว้างและอยู่ตรงกลาง */
  #auditLogModal .modal-head > div:nth-child(2) {
    margin-right: 0 !important;
    margin-top: 10px !important;
    width: 100% !important;
    justify-content: center !important;
  }
  
  #auditLogModal .modal-head > div:nth-child(2) button {
    width: 100% !important;
    justify-content: center !important;
  }

  /* 3. ส่วนตัวกรอง (Filter Bar): เรียงช่องค้นหาและวันที่ให้เต็มจอ */
  #auditLogModal .modal-box > div:nth-child(2) {
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 15px !important;
    gap: 12px !important;
  }
  
  #auditLogModal .modal-box > div:nth-child(2) > div,
  #auditLogModal .modal-box > div:nth-child(2) > select {
    width: 100% !important;
  }

  /* 4. ส่วนตาราง: ปรับให้สามารถเอานิ้วปัดเลื่อนซ้าย-ขวาได้ (Horizontal Scroll) */
  #auditPrintArea {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  
  #auditPrintArea table {
    min-width: 900px !important; /* ล็อกความกว้างตารางไว้ไม่ให้คอลัมน์บีบจนพัง */
  }
}