/* =========================================================
   app.css — Layout shell สำหรับ Bootstrap 5.3.3
   แทนที่ Argon Dashboard (Bootstrap 4) ที่ถอดออกไป
   ========================================================= */

:root {
  --bs-primary: #5e72e4;
  --bs-primary-rgb: 94, 114, 228;
  --app-sidebar-w: 250px;
  --app-sidebar-bg: #ffffff;
  --app-header-h: 60px;
}

body {
  font-family: "Sarabun", system-ui, -apple-system, "Segoe UI", sans-serif;
  background-color: #f8f9fe;
  font-size: 0.9rem;
}

/* ---------- ปรับโทนสีหลักให้ใกล้เคียงระบบเดิม ---------- */
.btn-primary,
.bg-primary {
  --bs-btn-bg: #5e72e4;
  --bs-btn-border-color: #5e72e4;
  --bs-btn-hover-bg: #4c5fd7;
  --bs-btn-hover-border-color: #4c5fd7;
  --bs-btn-active-bg: #4553c8;
  --bs-btn-active-border-color: #4553c8;
}
.bg-primary {
  background-color: #5e72e4 !important;
}
.text-primary {
  color: #5e72e4 !important;
}
a {
  color: #5e72e4;
}
a:hover {
  color: #4553c8;
}

/* =========================================================
   Sidebar
   ========================================================= */
.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--app-sidebar-w);
  background: var(--app-sidebar-bg);
  border-right: 1px solid #e9ecef;
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: transform 0.25s ease;
}

.app-sidebar-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e9ecef;
  min-height: var(--app-header-h);
}

.app-sidebar-header img {
  max-height: 38px;
  width: auto;
}

.app-sidebar-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.75rem 0;
}

/* scrollbar บาง */
.app-sidebar-body::-webkit-scrollbar {
  width: 6px;
}
.app-sidebar-body::-webkit-scrollbar-thumb {
  background: #cbd3da;
  border-radius: 3px;
}

/* ---------- เมนู ---------- */
.app-nav {
  list-style: none;
  margin: 0;
  padding: 0;
}
.app-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 1.25rem;
  color: #525f7f;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  border-left: 3px solid transparent;
}
.app-nav .nav-link:hover {
  color: #5e72e4;
  background-color: #f6f9fc;
}
.app-nav .nav-link.active {
  color: #5e72e4;
  background-color: #f0f3ff;
  border-left-color: #5e72e4;
}
.app-nav .nav-link > i {
  width: 1.25rem;
  text-align: center;
  font-size: 0.95rem;
  flex: 0 0 auto;
}
.app-nav .nav-link[data-bs-toggle="collapse"]::after {
  content: "\f107"; /* fa-angle-down */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  margin-left: auto;
  font-size: 0.75rem;
  transition: transform 0.2s ease;
}
.app-nav .nav-link[data-bs-toggle="collapse"][aria-expanded="true"]::after {
  transform: rotate(180deg);
}

/* ---------- เมนูย่อย ---------- */
.app-nav-sub {
  list-style: none;
  margin: 0;
  padding: 0;
  background-color: #fbfcfe;
}
.app-nav-sub .nav-link {
  padding: 0.45rem 1.25rem 0.45rem 3.1rem;
  font-size: 0.825rem;
  font-weight: 400;
  border-left: 3px solid transparent;
}
.app-nav-sub .nav-link::before {
  content: "";
  position: absolute;
  left: 2.1rem;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #adb5bd;
}
.app-nav-sub .nav-link {
  position: relative;
}
.app-nav-sub .nav-link.active::before {
  background: #5e72e4;
}

.app-nav-heading {
  padding: 1rem 1.25rem 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #8898aa;
}

/* =========================================================
   Main content
   ========================================================= */
.app-main {
  margin-left: var(--app-sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.25s ease;
}

/* หน้าที่ไม่มี sidebar — ใช้ความกว้างเต็มจอ (ยังไม่มีหน้าไหนใช้ เก็บไว้เผื่อหน้าพิเศษ) */
.app-main-full {
  margin-left: 0;
}

/* ชั้นทับสีบนภาพพื้นหลัง (แทน .mask ของ Argon เดิม) */
.mask {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}

.app-topbar {
  min-height: var(--app-header-h);
}

.app-content {
  flex: 1 1 auto;
}

/* ---------- แถบหัวหน้า (แทน .header.bg-primary + .mt--6 ของ Argon) ---------- */
.app-pageheader {
  padding: 1.5rem 0 1.5rem;
  color: #fff;
}
.app-pageheader h1,
.app-pageheader h2,
.app-pageheader h3,
.app-pageheader h4,
.app-pageheader h5,
.app-pageheader h6 {
  color: #fff;
  margin-bottom: 0;
}

/* ชื่อหน้าบนแถบหัว: ใช้ขนาดเดียวกันทุกหน้า (อ้างอิงจากหน้า Dashboard) */
h6.h2.text-white.d-inline-block,
.app-pageheader .h2.text-white.d-inline-block {
  font-size: 1.15rem;
}

/* ปุ่มในแถบหัวหน้า: ให้เว้นระยะห่างทั้งแนวนอนและแนวตั้งเมื่อขึ้นบรรทัดใหม่ */
.app-pageheader .btn {
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
  margin-left: 0.15rem;
  margin-right: 0.15rem;
}

/* ---------- Sidebar ยุบ (จอใหญ่) ---------- */
body.app-sidebar-collapsed .app-sidebar {
  transform: translateX(-100%);
}
body.app-sidebar-collapsed .app-main {
  margin-left: 0;
}

/* ---------- จอเล็ก: sidebar เป็น overlay ---------- */
@media (max-width: 1199.98px) {
  .app-sidebar {
    transform: translateX(-100%);
    box-shadow: 0 0 2rem rgba(0, 0, 0, 0.15);
  }
  body.app-sidebar-open .app-sidebar {
    transform: translateX(0);
  }
  .app-main {
    margin-left: 0;
  }
  body.app-sidebar-collapsed .app-sidebar {
    transform: translateX(-100%);
  }
  .app-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1035;
  }
}

/* =========================================================
   Components ที่มาแทนของ Argon
   ========================================================= */

/* ---------- .card-stats ---------- */
.stat-card {
  border: 0;
  box-shadow: 0 0 2rem 0 rgba(136, 152, 170, 0.15);
}
.stat-card .card-title {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #8898aa;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}
.stat-card .stat-value {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 0;
}

/* ---------- .icon.icon-shape ---------- */
.stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  color: #fff;
  font-size: 1.1rem;
  box-shadow:
    0 0.25rem 0.5rem rgba(0, 0, 0, 0.1),
    0 0.1rem 0.2rem rgba(0, 0, 0, 0.08);
}
.stat-icon-sm {
  width: 2.25rem;
  height: 2.25rem;
  font-size: 0.9rem;
}

/* ---------- gradient (ที่ใช้จริงในระบบ) ---------- */
.bg-gradient-primary {
  background: linear-gradient(87deg, #5e72e4 0, #825ee4 100%) !important;
}
.bg-gradient-secondary {
  background: linear-gradient(87deg, #f7fafc 0, #f7f8fc 100%) !important;
}
.bg-gradient-info {
  background: linear-gradient(87deg, #11cdef 0, #1171ef 100%) !important;
}
.bg-gradient-success,
.bg-gradient-green {
  background: linear-gradient(87deg, #2dce89 0, #2dcecc 100%) !important;
}
.bg-gradient-danger,
.bg-gradient-red {
  background: linear-gradient(87deg, #f5365c 0, #f56036 100%) !important;
}
.bg-gradient-warning,
.bg-gradient-orange {
  background: linear-gradient(87deg, #fb6340 0, #fbb140 100%) !important;
}
.bg-gradient-yellow {
  background: linear-gradient(87deg, #ffd600 0, #beff00 100%) !important;
}
.bg-gradient-default,
.bg-gradient-dark {
  background: linear-gradient(87deg, #172b4d 0, #1a174d 100%) !important;
}
.bg-gradient-purple {
  background: linear-gradient(87deg, #8965e0 0, #bc65e0 100%) !important;
}

/* ---------- .btn-neutral (ปุ่มขาว ใช้บนพื้นสีเข้ม) ----------
   คลาสนี้เดิมมาจาก Argon (Bootstrap 4) ซึ่งถูกถอดออกไป
   จึงต้องนิยามใหม่ ไม่งั้นปุ่มจะกลายเป็นพื้นใสมองไม่เห็นว่าเป็นปุ่ม */
.btn-neutral {
  --bs-btn-color: #5e72e4;
  --bs-btn-bg: #fff;
  --bs-btn-border-color: #fff;
  --bs-btn-hover-color: #5e72e4;
  --bs-btn-hover-bg: #f4f5f7;
  --bs-btn-hover-border-color: #f4f5f7;
  --bs-btn-active-color: #5e72e4;
  --bs-btn-active-bg: #e9ecef;
  --bs-btn-active-border-color: #e9ecef;
  --bs-btn-disabled-color: #8898aa;
  --bs-btn-disabled-bg: #fff;
  --bs-btn-disabled-border-color: #fff;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.1);
}

/* ---------- .avatar ---------- */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  background-color: #adb5bd;
  color: #fff;
  font-size: 1rem;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.avatar-sm {
  width: 36px;
  height: 36px;
  font-size: 0.875rem;
}
.avatar-xs {
  width: 28px;
  height: 28px;
  font-size: 0.75rem;
}

/* ---------- ตาราง (แทน .table-flush / .thead-light) ---------- */
.table > :not(caption) > * > * {
  padding: 0.75rem 1rem;
}
.table thead th {
  background-color: #f6f9fc;
  color: #8898aa;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  border-bottom: 1px solid #e9ecef;
  white-space: nowrap;
}
.table-flush > :not(caption) > * > *:first-child {
  padding-left: 1.5rem;
}
.table-flush > :not(caption) > * > *:last-child {
  padding-right: 1.5rem;
}

/* ---------- Card ---------- */
.card {
  border: 0;
  box-shadow: 0 0 2rem 0 rgba(136, 152, 170, 0.15);
  margin-bottom: 1.5rem;
}
.card-header {
  background-color: #fff;
  border-bottom: 1px solid #e9ecef;
  padding: 1.25rem 1.5rem;
}
/* หัวการ์ด: ลดขนาดหัวข้อให้กระชับ ใช้สเกลเดียวกันทุกหน้า */
.card-header h1,
.card-header .h1 {
  font-size: 1.15rem;
}
.card-header h2,
.card-header .h2 {
  font-size: 1.05rem;
}
.card-header h3,
.card-header .h3 {
  font-size: 0.95rem;
}
.card-header h4,
.card-header .h4 {
  font-size: 0.9rem;
}
.card-header h5,
.card-header .h5 {
  font-size: 0.88rem;
}
.card-header h6,
.card-header .h6 {
  font-size: 0.85rem;
}
.card-header .card-title {
  font-size: 0.95rem;
}

/* ---------- Modal ---------- */
/* หลาย modal ในระบบมี <form> คร่อม .modal-body ไว้ ทำให้ .modal-dialog-scrollable
   ของ Bootstrap ไม่ทำงาน (form ไม่ได้เป็น flex item ในสาย flex ของ .modal-content)
   กฎนี้ทำให้ form ส่งต่อ flex/ความสูงลงไปให้ .modal-body เลื่อนได้ตามปกติ */
.modal-dialog-scrollable .modal-content > form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* ---------- Modal จัดการรายการรับเข้า-จ่ายออกพัสดุ (#modalWasaduIO) ----------
   ใช้ร่วมกันที่ pageWasadu.php และ pageWasaduDurable.php โดยเนื้อหามาจาก
   viewWasaduIO.php */
#modalWasaduIO .modal-dialog {
  max-width: 96%;
  width: 96%;
  margin: 1.5vh auto;
}
#modalWasaduIO .modal-content {
  max-height: 97vh;
}
#modalWasaduIO .modal-body {
  background-color: #f8f9fe;
}
/* แถบเครื่องมือด้านบน (ปีงบประมาณ + ปุ่ม) */
#modalWasaduIO .io-toolbar {
  background-color: #fff;
  border: 1px solid #e9ecef;
  border-radius: 0.375rem;
  padding: 0.75rem 1rem;
}
#modalWasaduIO .io-toolbar .form-label {
  margin-bottom: 0;
  white-space: nowrap;
}
#modalWasaduIO .io-toolbar select.form-select {
  min-width: 120px;
  max-width: 160px;
}
/* ตารางรายการ */
#modalWasaduIO .card-io-table {
  background-color: #fff;
  border: 1px solid #e9ecef;
  border-radius: 0.375rem;
  padding: 0.75rem 1rem 0.25rem;
}
#modalWasaduIO #tblWasaduIO {
  font-size: 0.8rem;
}
#modalWasaduIO #tblWasaduIO > :not(caption) > * > * {
  padding: 0.4rem 0.5rem;
  vertical-align: middle;
}
#modalWasaduIO #tblWasaduIO thead th {
  font-size: 0.68rem;
  white-space: nowrap;
}
#modalWasaduIO #tblWasaduIO .btn-sm {
  font-size: 0.7rem;
  padding: 0.2rem 0.45rem;
  line-height: 1.2;
}
#modalWasaduIO .io-actions,
#modalWasaduIO .io-sort {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.25rem;
  justify-content: center;
}
#modalWasaduIO .dataTables_wrapper .dataTables_length,
#modalWasaduIO .dataTables_wrapper .dataTables_filter,
#modalWasaduIO .dataTables_wrapper .dataTables_info,
#modalWasaduIO .dataTables_wrapper .dataTables_paginate {
  font-size: 0.78rem;
}
.card-body {
  padding: 1.5rem;
}

/* ---------- ฟอร์ม ---------- */
.form-control-labe,
.form-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #000;
  margin-bottom: 0.5rem;
}
.form-control:focus,
.form-select:focus {
  border-color: #8a98eb;
  box-shadow: 0 0 0 0.2rem rgba(94, 114, 228, 0.18);
}

/* ---------- utility ที่โค้ดเดิมใช้ ---------- */
.text-sm {
  font-size: 0.8rem !important;
}
.text-xs {
  font-size: 0.7rem !important;
}
.text-lg {
  font-size: 1.05rem !important;
}
.ls-1 {
  letter-spacing: 0.0625rem;
}

/* =========================================================
   DataTables / Select2 เข้ากับ BS5
   ========================================================= */
/* ---- ระยะห่างรอบ wrapper (การ์ดไม่มี padding ในตัว) ----
 * บางหน้าใช้ .table-responsive เปล่า บางหน้าใส่ py-4/py-5 มาด้วย
 * จึงกำหนดระยะที่ wrapper แล้วล้าง py-* ของ .table-responsive ที่ครอบ DataTable
 * ให้ทุกหน้าได้ระยะห่างเท่ากัน
 */
div.dataTables_wrapper {
  padding: 1.25rem 1.5rem;
}
.table-responsive:has(> div.dataTables_wrapper) {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  /* ยกเลิก scrollbar ซ้าย-ขวาของ BS5 : DataTables ใช้ Responsive ยุบคอลัมน์แทน
   * (ตารางธรรมดาที่ไม่ใช่ DataTables ยังเลื่อนได้ตามเดิม) */
  overflow-x: visible;
}
/* .row ของ BS5 มี negative margin ซึ่งจะกินระยะ padding ด้านบนไป จึงล้างทิ้ง */
div.dataTables_wrapper > .row {
  margin-left: 0;
  margin-right: 0;
  --bs-gutter-x: 0;
}
div.dataTables_wrapper > .row > [class^="col-"],
div.dataTables_wrapper > .row > [class*=" col-"] {
  padding-left: 0;
  padding-right: 0;
}
table.dataTable {
  width: 100% !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

/* ---- แถวควบคุมด้านบน : จำนวนรายการ + ค้นหา ---- */
div.dataTables_wrapper div.dataTables_length,
div.dataTables_wrapper div.dataTables_filter {
  margin-bottom: 1rem;
}
div.dataTables_wrapper div.dataTables_length label,
div.dataTables_wrapper div.dataTables_filter label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: #525f7f;
  white-space: nowrap;
}
div.dataTables_wrapper div.dataTables_filter label {
  justify-content: flex-end;
}
div.dataTables_wrapper div.dataTables_filter input,
div.dataTables_wrapper div.dataTables_length select {
  margin-left: 0;
  margin-right: 0;
  border-radius: 8px;
  border: 1px solid #dee2e6;
  color: #32325d;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
div.dataTables_wrapper div.dataTables_length select {
  width: auto;
  min-width: 5rem;
  padding-right: 2rem;
}
div.dataTables_wrapper div.dataTables_filter input {
  width: 100%;
  max-width: 16rem;
  padding: 0.4rem 0.75rem;
}
div.dataTables_wrapper div.dataTables_filter input:focus,
div.dataTables_wrapper div.dataTables_length select:focus {
  border-color: #8a98eb;
  box-shadow: 0 0 0 0.2rem rgba(94, 114, 228, 0.18);
  outline: 0;
}
.dt-buttons .btn {
  margin-right: 0.25rem;
  margin-bottom: 0.25rem;
}

/* ---- หัวตาราง / เซลล์ ----
 * ไม่แตะ .table-bordered เพราะตารางกลุ่มนั้นต้องการเส้นตีกรอบครบทุกด้านอยู่แล้ว
 */
table.dataTable thead th {
  padding: 0.85rem 1rem;
  vertical-align: middle;
  background-color: #f6f9fc;
  /* .table thead th ตั้ง nowrap ไว้ ทำให้ Responsive คิด minWidth ของหัวคอลัมน์
   * ยาวเกินจำเป็นแล้วยุบคอลัมน์เยอะเกินไป จึงยอมให้หัวตารางตัดบรรทัดได้ */
  white-space: normal;
}
table.dataTable:not(.table-bordered) thead th {
  border-top: 0;
  border-bottom: 1px solid #e9ecef;
}
table.dataTable tbody td {
  padding: 0.7rem 1rem;
  vertical-align: middle;
  font-size: 0.85rem;
  color: #525f7f;
}
table.dataTable:not(.table-bordered) tbody td {
  border-bottom: 1px solid #f1f4f8;
}
table.dataTable:not(.table-bordered) tbody tr:last-child td {
  border-bottom: 0;
}
table.dataTable tbody tr:hover > td {
  background-color: #fafbfe;
}
table.dataTable tfoot th,
table.dataTable tfoot td {
  padding: 0.75rem 1rem;
  vertical-align: middle;
  font-size: 0.85rem;
  font-weight: 600;
  color: #32325d;
  background-color: #f6f9fc;
}
table.dataTable:not(.table-bordered) tfoot th,
table.dataTable:not(.table-bordered) tfoot td {
  border-top: 1px solid #e9ecef;
}

/* ปุ่มในคอลัมน์จัดการข้อมูล : ให้เรียงกันมีระยะห่างสม่ำเสมอ ป้องกันปุ่มชิดกันเมื่อขึ้นบรรทัดใหม่ */
table.dataTable tbody td > .btn,
table.dataTable tbody td > form > .btn,
table.dataTable tbody td > a.btn,
.table tbody td > .btn,
.table tbody td > form > .btn,
.table tbody td > a.btn {
  margin: 0.25rem 0.2rem;
  vertical-align: middle;
}

/* ---- ไอคอนเรียงลำดับ : เว้นที่ไม่ให้ทับข้อความหัวคอลัมน์ ---- */
table.dataTable thead > tr > th.sorting,
table.dataTable thead > tr > th.sorting_asc,
table.dataTable thead > tr > th.sorting_desc {
  padding-right: 1.75rem;
}

/* ---- แถวล่าง : ข้อมูลจำนวนรายการ + หน้า ---- */
div.dataTables_wrapper div.dataTables_info {
  padding-top: 1rem;
  font-size: 0.8rem;
  color: #8898aa;
}
div.dataTables_wrapper div.dataTables_paginate {
  padding-top: 1rem;
  margin: 0;
}
div.dataTables_wrapper div.dataTables_paginate ul.pagination {
  margin: 0;
  justify-content: flex-end;
  gap: 0.25rem;
  flex-wrap: wrap;
}
div.dataTables_wrapper ul.pagination .page-link {
  min-width: 2.25rem;
  text-align: center;
  border-radius: 8px;
  border: 1px solid #e9ecef;
  color: #525f7f;
  font-size: 0.8rem;
  padding: 0.4rem 0.6rem;
  transition: all 0.15s ease-in-out;
}
div.dataTables_wrapper ul.pagination .page-link:hover {
  background-color: #f6f9fc;
  border-color: #dee2e6;
  color: #32325d;
}
div.dataTables_wrapper ul.pagination .page-item.active .page-link {
  background-color: #5e72e4;
  border-color: #5e72e4;
  color: #fff;
  box-shadow: 0 2px 4px rgba(94, 114, 228, 0.3);
}
div.dataTables_wrapper ul.pagination .page-item.disabled .page-link {
  background-color: transparent;
  border-color: #f1f4f8;
  color: #ced4da;
}

/* ---- สถานะกำลังโหลด / ไม่พบข้อมูล ---- */
div.dataTables_wrapper div.dataTables_processing {
  border-radius: 8px;
  border: 1px solid #e9ecef;
  box-shadow: 0 4px 12px rgba(50, 50, 93, 0.12);
  font-size: 0.85rem;
  color: #525f7f;
  padding: 0.75rem 1rem;
  z-index: 10;
}
table.dataTable td.dataTables_empty {
  padding: 2rem 1rem;
  text-align: center;
  color: #8898aa;
  font-size: 0.85rem;
}

/* =========================================================
   DataTables Responsive : ยุบคอลัมน์ + ปุ่ม +/- คอลัมน์แรก
   แทน scrollbar ซ้าย-ขวา
   ========================================================= */
/* ---- ปุ่ม +/- (ปลั๊กอินเติมคลาส .dtr-control ให้คอลัมน์แรกเอง) ---- */
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control,
table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control {
  position: relative;
  padding-left: 2.4rem !important;
  cursor: pointer;
}
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control::before,
table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control::before {
  content: "+";
  position: absolute;
  top: 50%;
  left: 0.85rem;
  transform: translateY(-50%);
  display: inline-block;
  width: 1.15rem;
  height: 1.15rem;
  line-height: 1.1rem;
  border: 0;
  box-shadow: none;
  border-radius: 0.25rem;
  background-color: #5e72e4;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
}
table.dataTable.dtr-inline.collapsed > tbody > tr.parent > td.dtr-control::before,
table.dataTable.dtr-inline.collapsed > tbody > tr.parent > th.dtr-control::before {
  content: "\2212";
  background-color: #f5365c;
}
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control:hover::before {
  filter: brightness(1.08);
}

/* ---- แถวลูก : รายการคอลัมน์ที่ถูกซ่อน ---- */
table.dataTable > tbody > tr.child {
  background-color: #fbfcfe;
}
table.dataTable > tbody > tr.child:hover > td {
  background-color: #fbfcfe;
}
table.dataTable > tbody > tr.child ul.dtr-details {
  display: block;
  width: 100%;
  padding: 0.25rem 0;
}
table.dataTable > tbody > tr.child ul.dtr-details > li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid #f1f4f8;
  font-size: 0.85rem;
  color: #525f7f;
}
table.dataTable > tbody > tr.child ul.dtr-details > li:last-child {
  border-bottom: 0;
}
table.dataTable > tbody > tr.child span.dtr-title {
  display: inline-block;
  min-width: 9rem;
  font-weight: 600;
  color: #32325d;
}
table.dataTable > tbody > tr.child span.dtr-data > .btn,
table.dataTable > tbody > tr.child span.dtr-data > form > .btn,
table.dataTable > tbody > tr.child span.dtr-data > a.btn {
  margin: 0.25rem 0.2rem;
  display: inline-block;
}
@media (max-width: 575.98px) {
  table.dataTable > tbody > tr.child span.dtr-title {
    min-width: 100%;
  }
}

/* ---- ตารางกรอกข้อมูล : ปิด Responsive ไว้ (responsive:false) ----
 * ทุกคอลัมน์ต้องมองเห็นเพื่อกรอก จึงคืนการเลื่อนซ้าย-ขวาให้เฉพาะกลุ่มนี้
 * (selector มี id จึงชนะกฎ overflow-x:visible ด้านบน)
 */
.table-responsive:has(table#tblSearchWasaduMulti) {
  overflow-x: auto;
}
#tblSearchWasaduMulti,
#tblSearchWasaduMulti thead th,
#tblSearchWasaduMulti tbody td,
#tblSearchWasaduMulti tbody td span,
#tblSearchWasaduMulti tbody td div,
#tblSearchWasaduMulti tbody td label,
#tblSearchWasaduMulti input.search-price-input,
#tblSearchWasaduMulti input.search-qty-input {
  font-size: inherit !important;
}
#tblSearchWasaduMulti tbody td small {
  font-size: 0.85em !important;
}
#tblSearchWasaduMulti td,
#tblSearchWasaduMulti th {
  vertical-align: middle;
}

/* ---- ตารางที่คอลัมน์ 0 เป็น checkbox เลือกทั้งหมด ----
 * ย้ายปุ่มกาง/ยุบไปคอลัมน์ 1 ด้วย responsive.details = {type:'column', target:1}
 * โหมด column ไม่เติมคลาส .dtr-control ให้เอง จึงต้องวาดไอคอนที่คอลัมน์ 1 เอง
 * (คอลัมน์ 0 กับ 1 ถูกตรึงด้วย data-priority จึงเป็น td ลำดับที่ 2 เสมอ)
 */
table.dataTable.collapsed#tblUser > tbody > tr > td:nth-child(2),
table.dataTable.collapsed#tblDeleteList > tbody > tr > td:nth-child(2),
table.dataTable.collapsed#tblTransferList > tbody > tr > td:nth-child(2),
table.dataTable.collapsed#tablePreviewRestore > tbody > tr > td:nth-child(2) {
  position: relative;
  padding-left: 2.4rem !important;
  cursor: pointer;
}
table.dataTable.collapsed#tblUser > tbody > tr > td:nth-child(2)::before,
table.dataTable.collapsed#tblDeleteList > tbody > tr > td:nth-child(2)::before,
table.dataTable.collapsed#tblTransferList > tbody > tr > td:nth-child(2)::before,
table.dataTable.collapsed#tablePreviewRestore > tbody > tr > td:nth-child(2)::before {
  content: "+";
  position: absolute;
  top: 50%;
  left: 0.85rem;
  transform: translateY(-50%);
  display: inline-block;
  width: 1.15rem;
  height: 1.15rem;
  line-height: 1.1rem;
  border-radius: 0.25rem;
  background-color: #5e72e4;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
}
table.dataTable.collapsed#tblUser > tbody > tr.parent > td:nth-child(2)::before,
table.dataTable.collapsed#tblDeleteList > tbody > tr.parent > td:nth-child(2)::before,
table.dataTable.collapsed#tblTransferList > tbody > tr.parent > td:nth-child(2)::before,
table.dataTable.collapsed#tablePreviewRestore > tbody > tr.parent > td:nth-child(2)::before {
  content: "\2212";
  background-color: #f5365c;
}
/* แถวลูกของตารางกลุ่มนี้ไม่ต้องมีไอคอน */
table.dataTable.collapsed#tblUser > tbody > tr.child > td::before,
table.dataTable.collapsed#tblDeleteList > tbody > tr.child > td::before,
table.dataTable.collapsed#tblTransferList > tbody > tr.child > td::before,
table.dataTable.collapsed#tablePreviewRestore > tbody > tr.child > td::before {
  content: none;
}

/* ---- จอเล็ก : ให้ควบคุมด้านบน/ล่างเรียงเป็นแนวตั้ง และจัดระเบียบปุ่มบน Mobile ---- */
@media (max-width: 767.98px) {
  /* ปรับปรุงคอลัมน์ของ Page Header บน Mobile ให้เรียงเต็มความกว้างและไม่กระจุกตัว */
  .app-pageheader .header-body .row > [class*="col-"] {
    width: 100% !important;
  }
  .app-pageheader .header-body .row > .text-end,
  .app-pageheader .header-body .row > [class*="col-"]:last-child {
    text-align: left !important;
    margin-top: 0.5rem;
  }
  .app-pageheader .btn {
    margin-top: 0.3rem;
    margin-bottom: 0.3rem;
    margin-right: 0.35rem;
    margin-left: 0;
  }

  /* ปุ่มในตารางสำหรับ Mobile : เพิ่มระยะห่างให้กดได้ง่าย ไม่ติดกัน */
  table.dataTable tbody td > .btn,
  table.dataTable tbody td > a.btn,
  .table tbody td > .btn,
  .table tbody td > a.btn {
    margin-top: 0.3rem;
    margin-bottom: 0.3rem;
  }

  div.dataTables_wrapper {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  div.dataTables_wrapper div.dataTables_length label,
  div.dataTables_wrapper div.dataTables_filter label {
    justify-content: flex-start;
  }
  div.dataTables_wrapper div.dataTables_filter input {
    max-width: 100%;
  }
  div.dataTables_wrapper div.dataTables_info,
  div.dataTables_wrapper div.dataTables_paginate {
    text-align: center;
  }
  div.dataTables_wrapper div.dataTables_paginate ul.pagination {
    justify-content: center;
  }
}

.select2-container {
  width: 100% !important;
}
.select2-container--bootstrap-5 .select2-selection {
  min-height: calc(1.5em + 0.75rem + 2px);
}

/* =========================================================
   พิมพ์: ซ่อน shell
   ========================================================= */
@media print {
  .app-sidebar,
  .app-topbar,
  .app-pageheader,
  .no-print {
    display: none !important;
  }
  .app-main {
    margin-left: 0 !important;
  }
  .card {
    box-shadow: none !important;
  }
}

/* =========================================================
   Timeline Component (ธีมสว่าง Modern Light Theme)
   ========================================================= */
.timeline {
  position: relative;
  padding-left: 0.25rem;
}
.timeline-one-side::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 17px;
  width: 2px;
  background-color: #e3e8ee;
}
.timeline-block {
  position: relative;
  margin-bottom: 1.75rem;
}
.timeline-block:last-child {
  margin-bottom: 0;
}
.timeline-step {
  position: absolute;
  top: 0;
  left: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.88rem;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}
.timeline-content {
  position: relative;
  margin-left: 52px;
  padding-top: 0.15rem;
}

