@font-face { font-family: 'Sarabun'; src: url('../fonts/web/Sarabun-Regular.woff2') format('woff2'), url('../fonts/Sarabun-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Sarabun'; src: url('../fonts/web/Sarabun-Bold.woff2') format('woff2'), url('../fonts/Sarabun-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }
:root { --bs-body-font-family: 'Sarabun', Tahoma, sans-serif; --bs-body-font-size: .95rem; }
body { background: #f4f6fa; }
.sidebar { width: 260px; min-height: calc(100vh - 56px); background: #fff; border-right: 1px solid #e3e6ec; }
@media (min-width: 992px) { .sidebar { position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto; } }
.sidebar .nav-link { color: #333; border-radius: .4rem; padding: .45rem .75rem; }
.sidebar .nav-link:hover { background: #eef3ff; }
.sidebar .nav-link.active { background: #0d6efd; color: #fff; }
.sidebar .nav-link i { width: 1.4rem; display: inline-block; }
.nav-group { font-size: .78rem; color: #8a93a5; text-transform: uppercase; margin: .8rem .75rem .2rem; }
.main { min-width: 0; }
.card { border: 0; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.stat { border-left: 4px solid #0d6efd; }
.stat .num { font-size: 1.7rem; font-weight: 700; }
.table thead th { background: #eef2f8; white-space: nowrap; }
.search-results .list-group-item { cursor: pointer; }
.match-code { background: #e8f7ee; } .match-name { background: #eaf3ff; } .match-similar { background: #fff8e1; } .match-none { background: #fdecee; }
.ocr-text { max-height: 300px; overflow: auto; white-space: pre-wrap; font-size: .8rem; background: #f8f9fa; }
.timeline { list-style: none; padding-left: 0; } .timeline li { padding: .15rem 0; } .timeline .done { color: #198754; } .timeline .wait { color: #adb5bd; }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg,#0d6efd,#5b9bff); }
.table-sm td, .table-sm th { padding: .3rem .45rem; }
@media print { .sidebar, .navbar, .no-print { display: none !important; } .main { padding: 0 !important; } }
.th-cal { position: absolute; z-index: 2000; background: #fff; border: 1px solid #ccd3e0; border-radius: .5rem; padding: .5rem; width: 260px; font-size: .9rem; }
.th-cal table { width: 100%; text-align: center; } .th-cal th { font-weight: normal; color: #888; font-size: .8rem; }
.th-cal td button { border: 0; background: none; width: 30px; height: 28px; border-radius: .3rem; }
.th-cal td button:hover { background: #eef3ff; } .th-cal td button.sel { background: #0d6efd; color: #fff; } .th-cal td button.today { outline: 1px solid #0d6efd; }

/* แถบโหลดหน้า */
#navbar-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: linear-gradient(90deg, #ffc107, #0d6efd); z-index: 2000; opacity: 0; pointer-events: none; }

/* ค้นหาด่วน */
.qs-wrap { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 2100; display: none; align-items: flex-start; justify-content: center; padding-top: 10vh; }
.qs-box { background: #fff; border-radius: .6rem; width: min(640px, 94vw); overflow: hidden; }
.qs-list { max-height: 55vh; overflow-y: auto; }
.qs-item { display: flex; align-items: center; gap: .6rem; padding: .5rem .9rem; color: #222; text-decoration: none; }
.qs-item small { margin-left: auto; color: #888; white-space: nowrap; }
.qs-item.active, .qs-item:hover { background: #e7f0ff; color: #0b3d91; }
.man-sec { scroll-margin-top: 80px; } .man-steps li { margin-bottom: .4rem; }
/* เมนูด้านซ้าย 1 บรรทัด (ข้อความยาวตัดด้วย … และดูชื่อเต็มเมื่อชี้เมาส์) */
.sidebar .nav-link { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: .38rem .6rem; font-size: .95rem; }
.sidebar .nav-group { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 992px) { .sidebar { width: 232px; flex: 0 0 232px; } }

/* เมนูบนมือถือ/แท็บเล็ต (offcanvas): ให้ส่วนรายการเลื่อนได้ทั้งหมด */
@media (max-width: 991.98px) {
  .sidebar.offcanvas-lg { min-height: 0; height: 100%; height: 100dvh; display: flex; flex-direction: column; width: min(300px, 86vw); }
  .sidebar .offcanvas-header { flex: 0 0 auto; padding: .75rem 1rem; border-bottom: 1px solid #eef0f4; }
  .sidebar .sb-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding-bottom: env(safe-area-inset-bottom, 0); }
  .sidebar .nav-link { padding: .55rem .7rem; font-size: 1rem; }
}
/* ตารางบนมือถือ: ไม่บีบคอลัมน์จนข้อความขึ้นบรรทัดทีละคำ — ปัดตารางซ้าย/ขวาแทน */
@media (max-width: 767.98px) {
  .table-responsive > .table > thead th { white-space: nowrap; }
  .table-responsive > .table > tbody > tr > td { min-width: 6.5em; }
  .table-responsive > .table > tbody > tr > td:has(> .form-check-input:only-child),
  .table-responsive > .table > tbody > tr > td:has(> input[type=checkbox]:only-child),
  .table-responsive > .table > tbody > tr > td:empty { min-width: 0; }
  .table-responsive { -webkit-overflow-scrolling: touch; }
  .main { padding-left: .75rem !important; padding-right: .75rem !important; }
}
