/* ตั้งใจให้บางและไม่ override Bootstrap แบบ hack */
/* Theme: grayscale + subtle 3D elevation (use Bootstrap CSS variables only) */
:root {
  color-scheme: light;

  /* Motion tokens */
  --transition-snap:      100ms ease;
  --transition-standard:  200ms ease;
  --transition-elaborate: 300ms ease-out;

  --app-font-body: "Prompt", "Kanit", sans-serif;
  --app-font-heading: "Kanit", "Prompt", sans-serif;
  --app-surface: var(--bs-body-bg);
  --app-surface-2: var(--bs-secondary-bg);
  --app-border: var(--bs-border-color);
  --app-elev-1:
    0 0.6rem 1.6rem rgba(var(--bs-body-color-rgb), 0.08),
    0 0.15rem 0.45rem rgba(var(--bs-body-color-rgb), 0.06);
  --app-elev-2:
    0 1rem 2.5rem rgba(var(--bs-body-color-rgb), 0.1),
    0 0.35rem 0.9rem rgba(var(--bs-body-color-rgb), 0.08);
  --app-inset:
    inset 0 0.06rem 0 rgba(var(--bs-body-color-rgb), 0.06),
    inset 0 -0.06rem 0 rgba(var(--bs-body-color-rgb), 0.04);
  --app-focus:
    0 0 0 0.2rem rgba(var(--bs-body-color-rgb), 0.18);
}

body {
  background: var(--bs-tertiary-bg);
  color: var(--bs-body-color);
  font-family: var(--app-font-body);
  font-weight: 400;
}

button,
input,
optgroup,
select,
textarea,
.btn,
.form-control,
.form-select,
.form-check-label,
.input-group-text,
.dropdown-item,
.nav-link,
.navbar-brand,
.table,
.pagination,
.badge,
.alert,
.card,
.modal,
.offcanvas,
.list-group,
.breadcrumb {
  font-family: var(--app-font-body);
}

h1,
h2,
h3,
h4,
h5,
h6,
.navbar-brand,
.btn,
th,
.modal-title,
.card-title,
.dropdown-header {
  font-family: var(--app-font-heading);
}

/* Links: do not override Bootstrap accent utilities (keep original colors) */

.app-container {
  width: 100%;
  max-width: 78rem;
}

.search-highlight {
  display: inline;
  padding: 0 0.22em;
  border-radius: 0.35rem;
  background: rgba(251, 191, 36, 0.32);
  color: inherit;
  box-shadow: inset 0 -0.08rem 0 rgba(245, 158, 11, 0.22);
}

.app-live-search {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: nowrap;
  width: 100%;
  min-width: min(100%, 18rem);
}

.app-live-search--compact {
  max-width: 36rem;
}

.app-live-search__shell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 24rem;
  min-width: 0;
  padding: 0.375rem 0.75rem;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 0.5rem;
  background: var(--bs-body-bg);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
  cursor: text;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.app-live-search-form.is-loading .app-live-search__shell {
  border-color: rgba(37, 99, 235, 0.35);
}

.app-live-search__shell:focus-within {
  border-color: rgba(37, 99, 235, 0.5);
  box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.12);
}

.app-live-search__icon {
  width: 1.5rem;
  height: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 0.35rem;
  background: rgba(37, 99, 235, 0.08);
  color: #2563eb;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.08);
}

.app-live-search__field {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.22rem;
  min-width: 0;
  flex: 1 1 auto;
}

.app-live-search__input {
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
  min-width: 0;
  font-size: 0.98rem;
  font-weight: 500;
  color: var(--bs-body-color);
}

.app-live-search__input:focus {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.app-live-search__input::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

.app-live-search__hint {
  font-size: 0.78rem;
  color: var(--bs-secondary-color);
  line-height: 1.3;
}

.app-live-search__clear {
  border-radius: 0.85rem;
  white-space: nowrap;
  align-self: center;
}

.app-live-search__status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex: 0 0 auto;
  max-width: min(100%, 18rem);
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(248, 250, 252, 0.95);
  color: var(--bs-secondary-color);
  font-size: 0.82rem;
  font-weight: 500;
}

.app-live-search__status[data-state='idle'] {
  display: none;
}

.app-live-search__status::before {
  content: '';
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: #94a3b8;
  flex: 0 0 auto;
}

.app-live-search__status[data-state='loading'] {
  color: #1d4ed8;
  background: rgba(219, 234, 254, 0.88);
  border-color: rgba(147, 197, 253, 0.6);
}

.app-live-search__status[data-state='loading']::before {
  background: #2563eb;
  box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.32);
  animation: appLiveSearchPulse 1.1s ease infinite;
}

.app-live-search__status[data-state='done'] {
  color: #166534;
  background: rgba(240, 253, 244, 0.96);
  border-color: rgba(134, 239, 172, 0.75);
}

.app-live-search__status[data-state='done']::before {
  background: #16a34a;
}

.app-live-search__status[data-state='empty'] {
  color: #92400e;
  background: rgba(255, 251, 235, 0.96);
  border-color: rgba(253, 230, 138, 0.8);
}

.app-live-search__status[data-state='empty']::before {
  background: #f59e0b;
}

@keyframes appLiveSearchPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.32);
  }
  70% {
    box-shadow: 0 0 0 0.42rem rgba(37, 99, 235, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
  }
}

@media (max-width: 767.98px) {
  .app-live-search {
    flex-wrap: wrap;
  }

  .app-live-search--compact {
    max-width: none;
  }

  .app-live-search__shell,
  .app-live-search__status {
    width: 100%;
    max-width: none;
  }

  .app-live-search__clear {
    width: 100%;
  }
}

/* ===== Topbar / Navbar — Premium style ===== */
.app-topbar {
  background: var(--bs-body-bg);
  border-bottom: 1px solid var(--bs-border-color);
  padding: 0 2rem;
  min-height: 4.375rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 1030;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-topbar:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.app-topbar .app-topbar__header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex: 0 0 auto;
}

.app-topbar .app-topbar__panel {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1 1 auto;
  min-width: 0;
}

/* Navbar Title */
.app-topbar .navbar-title {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--bs-body-color);
  letter-spacing: -0.5px;
  text-decoration: none;
  padding: 0.7rem 1.15rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.9rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  z-index: 0;
}

.app-topbar .navbar-title::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(99, 102, 241, 0.04) 100%);
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: -1;
  border-radius: inherit;
}

.app-topbar .navbar-title:is(:hover, :focus-visible, :active)::before {
  opacity: 1;
}

.app-topbar .navbar-title:is(:hover, :focus-visible, :active) {
  color: #2563eb;
  border-color: var(--bs-body-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
  text-decoration: none;
}

.app-topbar .navbar-title:focus-visible {
  outline: none;
}

.app-topbar .navbar-title.active {
  background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
  color: #fbbf24;
  font-weight: 600;
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(31, 41, 55, 0.25);
}

.app-topbar .navbar-title.active::before {
  opacity: 0;
}

.app-topbar .navbar-title.active:hover,
.app-topbar .navbar-title.active:focus-visible,
.app-topbar .navbar-title.active:active {
  color: #fbbf24;
  border-color: transparent;
  transform: translateY(-3px);
  box-shadow: 0 6px 24px rgba(31, 41, 55, 0.35);
  text-decoration: none;
}

/* Nav Items Container */
.app-topbar .nav-items {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

/* Nav Item Base */
.app-topbar .nav-item {
  position: relative;
  padding: 0.625rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--bs-secondary-color);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 0.625rem;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  white-space: nowrap;
  text-decoration: none;
  border: none;
  background: none;
  font-family: inherit;
}

/* Background gradient on hover */
.app-topbar .nav-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(99, 102, 241, 0.04) 100%);
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: -1;
  border-radius: 0.625rem;
}

.app-topbar .nav-item:hover::before {
  opacity: 1;
}

/* Hover state */
.app-topbar .nav-item:hover {
  color: #2563eb;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
  text-decoration: none;
}

/* Active state with badge style */
.app-topbar .nav-item.active {
  background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
  color: #fbbf24;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(31, 41, 55, 0.25);
  padding: 0.625rem 1.5rem;
}

.app-topbar .nav-item.active:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 24px rgba(31, 41, 55, 0.35);
  color: #fbbf24;
  text-decoration: none;
}

/* Underline for active item */
.app-topbar .nav-item.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  right: 50%;
  height: 3px;
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
  border-radius: 2px 2px 0 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Icon styling */
.app-topbar .nav-item i {
  font-size: 0.8125rem;
  transition: all 0.3s ease;
}

.app-topbar .nav-item:hover i {
  transform: scale(1.15) rotate(5deg);
}

.app-topbar .nav-item.active i {
  animation: navIconPulse 0.6s ease;
}

@keyframes navIconPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* Ripple Effect (non-active items) */
.app-topbar .nav-item:not(.active)::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.3);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.app-topbar .nav-item:not(.active):active::after {
  animation: navRipple 0.6s ease-out;
}

@keyframes navRipple {
  0% { width: 0; height: 0; opacity: 1; }
  100% { width: 300px; height: 300px; opacity: 0; }
}

/* Nav Actions (right side) */
.app-topbar .nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  flex: 0 0 auto;
}

.app-topbar .nav-actions form {
  display: flex;
  margin: 0;
}

/* Logout button — always danger */
.app-topbar .nav-item--logout {
  color: #fff;
  background: #dc2626;
  border-radius: 0.625rem;
}
.app-topbar .nav-item--logout:hover {
  background: #b91c1c;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}
.app-topbar .nav-item--logout::before {
  display: none;
}

/* Hamburger toggle (mobile only) */
.app-topbar .navbar-toggle {
  display: none;
  align-items: center;
  gap: 0.45rem;
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 0.8rem;
  padding: 0.55rem 0.8rem;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--bs-secondary-color);
  transition: all 0.3s ease;
  position: relative;
  margin-left: auto;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
}
.app-topbar .navbar-toggle__badge {
  position: absolute;
  top: -0.45rem;
  right: -0.45rem;
  font-size: 0.68rem;
  padding: 0.15rem 0.4rem;
}

.app-topbar .navbar-toggle:hover {
  color: #2563eb;
  border-color: #93c5fd;
}

.app-topbar .navbar-toggle__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 0.55rem;
  background: rgba(37, 99, 235, 0.08);
}

.app-topbar .navbar-toggle__text {
  line-height: 1;
}

/* กล่องอนุมัติบน navbar — แสดงเฉพาะมือถือ/tablet (desktop ใช้ใน panel) */
.app-topbar .header-approvals {
  display: none;
  position: relative;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.8rem;
  background: var(--bs-body-bg);
  color: var(--bs-secondary-color);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  flex: 0 0 auto;
  transition: all 0.3s ease;
}
.app-topbar .header-approvals i {
  font-size: 1.05rem;
}
.app-topbar .header-approvals:hover,
.app-topbar .header-approvals:focus-visible {
  color: #2563eb;
  border-color: #93c5fd;
}
/* active (อยู่หน้ากล่องอนุมัติ) — ค้างสีเหมือน nav-item.active / Dashboard */
.app-topbar .header-approvals.active {
  background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
  border-color: transparent;
  color: #fbbf24;
  font-weight: 700;
}
.app-topbar .header-approvals.active:hover {
  color: #fbbf24;
}
.app-topbar .header-approvals__badge {
  position: absolute;
  top: -0.4rem;
  right: -0.4rem;
  font-size: 0.68rem;
  padding: 0.15rem 0.4rem;
}

@media (max-width: 768px) {
  .app-topbar {
    padding: 0.8rem 1rem;
    height: auto;
    min-height: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.8rem;
  }

  .app-topbar .app-topbar__header {
    width: 100%;
    justify-content: space-between;
  }

  .app-topbar .navbar-toggle {
    display: inline-flex;
    flex: 0 0 auto;
  }

  /* มือถือ/tablet: กล่องอนุมัติโผล่บน navbar, ซ่อนตัวที่อยู่ในเมนู (กันซ้ำ) */
  .app-topbar .header-approvals {
    display: inline-flex;
  }
  .app-topbar .nav-item--approvals-panel {
    display: none;
  }

  .app-topbar .navbar-title {
    margin-right: 0;
    font-size: 1rem;
    padding: 0.72rem 0.95rem;
    border-radius: 0.85rem;
    max-width: calc(100% - 5.5rem);
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .app-topbar .app-topbar__panel {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.8rem;
    padding: 0.9rem;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 1rem;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(255, 255, 255, 0.98));
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
  }

  .app-topbar.open .app-topbar__panel {
    display: flex;
  }

  .app-topbar .nav-items,
  .app-topbar .nav-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
    margin-left: 0;
  }

  .app-topbar .nav-actions {
    padding-top: 0.75rem;
    border-top: 1px solid rgba(226, 232, 240, 0.95);
  }

  .app-topbar .nav-actions form {
    width: 100%;
  }

  .app-topbar .nav-item {
    width: 100%;
    justify-content: flex-start;
    padding: 0.8rem 0.95rem;
    font-size: 0.92rem;
    border-radius: 0.85rem;
    box-shadow: none;
  }

  .app-topbar .nav-item.active {
    padding: 0.85rem 1rem;
    transform: none;
  }

  .app-topbar .nav-item:hover {
    transform: none;
  }

  .app-topbar .nav-item i {
    width: 1rem;
    text-align: center;
  }

  .app-topbar .nav-item--logout {
    justify-content: center;
  }
}

@media (max-width: 420px) {
  .app-topbar {
    padding: 0.7rem 0.8rem;
  }

  .app-topbar .navbar-title {
    font-size: 0.95rem;
    padding: 0.68rem 0.88rem;
  }

  .app-topbar .navbar-toggle {
    padding: 0.5rem 0.7rem;
  }

  .app-topbar .navbar-toggle__text {
    display: none;
  }
}

/* Cards: subtle 3D elevation */
.card {
  background: var(--app-surface);
  border-color: var(--app-border);
  box-shadow: var(--app-elev-1);
}

/* Forms */
.form-control,
.form-select {
  background: var(--app-surface);
  border-color: var(--app-border);
  box-shadow: var(--app-inset);
}

/* Make native select chevron more consistent/visible */
.form-select {
  padding-right: 2.4rem;
  background-position: right 0.85rem center;
  background-size: 0.95rem 0.95rem;
}

.form-select:disabled {
  background-color: var(--bs-secondary-bg);
  opacity: 0.75;
}

.form-control:focus,
.form-select:focus {
  border-color: rgba(var(--bs-body-color-rgb), 0.28);
  box-shadow: var(--app-focus);
}

/* Buttons */
.btn {
  border-radius: 999px;
}

.btn,
.btn-group,
.btn-group-vertical {
  --bs-btn-focus-shadow-rgb: var(--bs-body-color-rgb);
}

.btn-primary,
.btn-success,
.btn-danger,
.btn-warning,
.btn-info,
.btn-dark,
.btn-outline-dark,
.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-success,
.btn-outline-danger,
.btn-outline-warning,
.btn-outline-info {
  box-shadow: var(--app-elev-1);
}

/* Tables: look like elevated surfaces while keeping responsive scroll */
.table-responsive {
  border: 1px solid var(--app-border);
  border-radius: var(--bs-border-radius-lg);
  background: var(--app-surface);
  box-shadow: var(--app-elev-1);
}

.table {
  margin-bottom: 0;
}

.table thead th {
  color: var(--bs-secondary-color);
  font-weight: 700;
}

.table tbody tr {
  border-color: rgba(var(--bs-body-color-rgb), 0.08);
}

/* Modal/popup: ensure long content remains scrollable on mobile WebViews (iOS/LINE) */
.modal-body {
  -webkit-overflow-scrolling: touch;
}

.table-responsive {
  -webkit-overflow-scrolling: touch;
}

/* OT summary table: ต้องเห็นครบทุกช่องบนจอคอมโดยไม่ต้องมี scrollbar */
.ot-summary-wrap .table-responsive {
  overflow-x: auto;
}

@media (min-width: 992px) {
  .ot-summary-wrap .table-responsive {
    overflow-x: visible;
  }
}

.ot-summary-table {
  width: 100%;
  min-width: 60rem;
  table-layout: fixed;
}

.ot-summary-table th,
.ot-summary-table td {
  padding: 0;
  font-size: 0.875rem;
  line-height: 1.15;
}

/* OT signatures: show clearly and fit within cell */
.ot-summary-table td.ot-signature-cell {
  padding: 0.15rem;
}

.ot-signature-img {
  display: block;
  margin: 0 auto;
  height: clamp(1.5rem, 2.5vw, 2.25rem);
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

/* ไม่มีลายเซ็น → แสดงชื่อแทน */
.ot-signature-name {
  display: block;
  padding-inline: 0.2rem;
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

/* dark mode: ลายเซ็นเป็นเส้นดำบนพื้นโปร่งใส → invert ให้เป็นเส้นขาว; ชื่อแทนลายเซ็นก็ขาว */
[data-bs-theme="dark"] .ot-signature-img {
  filter: invert(1);
}
[data-bs-theme="dark"] .ot-signature-name {
  color: #ffffff;
}

.ot-summary-table th {
  white-space: normal;
}

.ot-summary-table td:nth-child(3) {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  padding-inline: 0.35rem;
}

.ot-summary-table td:nth-child(4),
.ot-summary-table td:nth-child(6) {
  white-space: nowrap;
}

.ot-summary-table th:nth-child(4),
.ot-summary-table th:nth-child(6) {
  white-space: nowrap;
}

/* Workday detail (calendar matrix): wide table, scroll on mobile */
.workday-detail-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

.workday-detail-table th,
.workday-detail-table td {
  padding: 0.15rem;
  font-size: 0.75rem;
  line-height: 1.1;
}

.workday-detail-table th {
  white-space: nowrap;
}

.workday-detail-table td {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Keep date columns compact; allow name/position/summary to expand */
.workday-detail-table th,
.workday-detail-table td {
  min-width: 2.75rem;
}

.workday-col-seq {
  min-width: 3.5rem;
}

.workday-col-name {
  min-width: 12rem;
  white-space: nowrap;
}

.workday-col-position {
  min-width: 10rem;
  white-space: nowrap;
}

.workday-col-sum {
  min-width: 7.5rem;
  white-space: nowrap;
}

/* Use Bootstrap color tokens (avoid hard-coded hex) */
.bg-pink {
  background-color: var(--bs-pink, var(--bs-danger)) !important;
  color: var(--bs-dark, var(--bs-body-color)) !important;
}

.bg-purple {
  background-color: var(--bs-purple, var(--bs-primary)) !important;
  color: var(--bs-white, var(--bs-body-bg)) !important;
}

.bg-orange {
  background-color: var(--bs-orange, #fd7e14) !important;
  color: var(--bs-white, #fff) !important;
}

.bg-late-as-absent {
  background: linear-gradient(135deg, #D63384 50%, #DC3545 50%) !important;
  color: #fff !important;
}

#approvalModal #approvalModalReason,
#approvalModal #approvalModalAttachments,
#approvalViewModal #approvalViewReason,
#approvalViewModal #approvalViewAttachments {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Approval modal: prevent footer being cut off on short viewports (mobile/LINE WebView) */
#approvalModal .modal-dialog,
#approvalViewModal .modal-dialog {
  margin: 0.75rem;
  height: calc(100vh - 1.5rem);
  max-height: calc(100vh - 1.5rem);
}

@supports (height: 100dvh) {
  #approvalModal .modal-dialog,
  #approvalViewModal .modal-dialog {
    height: calc(100dvh - 1.5rem);
    max-height: calc(100dvh - 1.5rem);
  }
}

@media (min-width: 576px) {
  #approvalModal .modal-dialog,
  #approvalViewModal .modal-dialog {
    margin: 0.75rem auto;
  }
}

#approvalModal .modal-content,
#approvalViewModal .modal-content {
  height: 100%;
}

#approvalViewModal .modal-content {
  display: flex;
  flex-direction: column;
}

#approvalViewModal .modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#approvalModal #approvalModalForm {
  height: 100%;
  display: flex;
  flex-direction: column;
}

#approvalModal #approvalModalForm > .modal-header,
#approvalModal #approvalModalForm > .modal-footer {
  flex: 0 0 auto;
}

#approvalModal #approvalModalForm > .modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#approvalModal .modal-footer {
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-bottom: calc(var(--bs-modal-padding) + env(safe-area-inset-bottom));
}

.approval-detail-modal .modal-header {
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.8rem 0.9rem 0.55rem;
}

.approval-detail-modal .modal-body {
  padding: 0.55rem 0.9rem 0.9rem;
}

.approval-detail-modal .modal-footer {
  padding: 0.55rem 0.9rem 0.9rem;
}

.approval-detail-modal__header {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.approval-detail-modal__subtitle {
  color: var(--bs-secondary-color);
  font-size: 0.83rem;
  line-height: 1.3;
}

.approval-detail-modal__body {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.approval-detail-modal__section {
  border: 1px solid rgba(var(--bs-body-color-rgb), 0.08);
  border-radius: var(--bs-border-radius-lg);
  background: rgba(var(--bs-tertiary-bg-rgb), 0.38);
  padding: clamp(0.62rem, 1.4vw, 0.8rem);
}

.approval-detail-modal__section--summary {
  background: rgba(var(--bs-primary-rgb), 0.035);
}

.approval-detail-modal__section-title {
  margin-bottom: 0.5rem;
  color: var(--bs-emphasis-color);
  font-size: 0.88rem;
  font-weight: 700;
}

.approval-detail-modal__summary,
.approval-detail-modal__grid {
  display: grid;
  gap: 0.5rem;
}

.approval-detail-modal__summary {
  grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
}

.approval-detail-modal__grid {
  grid-template-columns: repeat(auto-fit, minmax(11.25rem, 1fr));
}

.approval-detail-modal__summary-item,
.approval-detail-modal__field {
  border: 1px solid rgba(var(--bs-body-color-rgb), 0.08);
  border-radius: var(--bs-border-radius-lg);
  background: rgba(var(--bs-body-bg-rgb), 0.92);
  padding: 0.56rem 0.65rem;
  min-width: 0;
}

.approval-detail-modal__field--wide {
  grid-column: 1 / -1;
}

.approval-detail-modal__label {
  color: var(--bs-secondary-color);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.25;
}

.approval-detail-modal__value {
  color: var(--bs-emphasis-color);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.35;
}

.approval-detail-modal__value-box,
.approval-detail-modal__content-box {
  margin-top: 0.32rem;
}

.approval-detail-modal__value-box {
  min-height: 2.2rem;
  border-radius: var(--bs-border-radius);
  background: rgba(var(--bs-tertiary-bg-rgb), 0.5);
  padding: 0.5rem 0.6rem;
  white-space: pre-wrap;
}

.approval-detail-modal__content-box {
  border: 1px dashed rgba(var(--bs-body-color-rgb), 0.1);
  border-radius: var(--bs-border-radius);
  background: rgba(var(--bs-body-bg-rgb), 0.88);
  padding: 0.5rem 0.6rem;
}

.approval-detail-modal__content-box:empty::before {
  content: "-";
  color: var(--bs-secondary-color);
}

.approval-detail-modal__decision-group {
  display: grid;
  gap: 0.45rem;
}

.approval-detail-modal__decision-group .form-check {
  margin: 0;
  min-height: 2.6rem;
  border: 1px solid rgba(var(--bs-body-color-rgb), 0.08);
  border-radius: var(--bs-border-radius-lg);
  background: rgba(var(--bs-body-bg-rgb), 0.9);
  padding: 0.62rem 0.75rem 0.62rem 2.25rem;
}

.approval-detail-modal__decision-group .form-check-input {
  margin-left: -1.25rem;
  margin-top: 0.15rem;
}

.approval-detail-modal__decision-group .form-check-label {
  color: var(--bs-emphasis-color);
  font-weight: 600;
  font-size: 0.9rem;
}

/* ผลการพิจารณา: สีกำกับให้สังเกตง่าย (อนุมัติ=เขียว / ไม่อนุมัติ=แดง / รอผล=เหลือง)
   + ตัวเลือกที่เลือกอยู่ = สีเข้ม (filled) */
.approval-detail-modal__decision-group .decision-opt {
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}
.approval-detail-modal__decision-group .decision-opt--approve {
  border-color: rgba(25, 135, 84, 0.45);
  background: rgba(25, 135, 84, 0.08);
}
.approval-detail-modal__decision-group .decision-opt--reject {
  border-color: rgba(220, 53, 69, 0.45);
  background: rgba(220, 53, 69, 0.08);
}
.approval-detail-modal__decision-group .decision-opt--hold {
  border-color: rgba(255, 193, 7, 0.55);
  background: rgba(255, 193, 7, 0.13);
}

/* selected = สีเข้ม */
.approval-detail-modal__decision-group .decision-opt--approve:has(.form-check-input:checked) {
  background: var(--bs-success);
  border-color: var(--bs-success);
}
.approval-detail-modal__decision-group .decision-opt--reject:has(.form-check-input:checked) {
  background: var(--bs-danger);
  border-color: var(--bs-danger);
}
.approval-detail-modal__decision-group .decision-opt--hold:has(.form-check-input:checked) {
  background: #cc9a06; /* เหลืองเข้ม อ่านตัวขาวออก */
  border-color: #cc9a06;
}
.approval-detail-modal__decision-group .decision-opt:has(.form-check-input:checked) .form-check-label {
  color: #fff;
}
.approval-detail-modal__decision-group .decision-opt:has(.form-check-input:checked) .form-check-input {
  border-color: rgba(255, 255, 255, 0.9);
}

.approval-detail-modal .table {
  margin-bottom: 0;
}

.approval-detail-modal__content-box .btn-sm {
  --bs-btn-padding-y: 0.18rem;
  --bs-btn-padding-x: 0.55rem;
  --bs-btn-font-size: 0.76rem;
}

.approval-detail-modal__content-box .table-sm > :not(caption) > * > * {
  padding: 0.32rem 0.4rem;
}

.approval-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.55rem;
  padding: 0.18rem 0.56rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.approval-status-badge--approved {
  color: var(--bs-success-text-emphasis, var(--bs-success));
  background: rgba(var(--bs-success-rgb), 0.1);
  border-color: rgba(var(--bs-success-rgb), 0.16);
}

.approval-status-badge--rejected {
  color: var(--bs-danger-text-emphasis, var(--bs-danger));
  background: rgba(var(--bs-danger-rgb), 0.1);
  border-color: rgba(var(--bs-danger-rgb), 0.15);
}

.approval-status-badge--held {
  color: var(--bs-warning-text-emphasis, #7a4f01);
  background: rgba(var(--bs-warning-rgb), 0.16);
  border-color: rgba(var(--bs-warning-rgb), 0.22);
}

.approval-status-badge--muted {
  color: var(--bs-secondary-color);
  background: rgba(var(--bs-secondary-rgb), 0.08);
  border-color: rgba(var(--bs-secondary-rgb), 0.12);
}

@media (max-width: 575.98px) {
  .approval-detail-modal__body {
    gap: 0.55rem;
  }

  .approval-detail-modal__section {
    padding: 0.56rem;
  }

  .approval-detail-modal__summary,
  .approval-detail-modal__grid {
    gap: 0.45rem;
  }

  .approval-detail-modal__summary-item,
  .approval-detail-modal__field {
    padding: 0.52rem 0.58rem;
  }

  .approval-detail-modal__decision-group .form-check {
    padding: 0.56rem 0.64rem 0.56rem 2.1rem;
  }

  .approval-detail-modal .modal-header,
  .approval-detail-modal .modal-body,
  .approval-detail-modal .modal-footer {
    padding-left: 0.72rem;
    padding-right: 0.72rem;
  }
}

/* Thai/B.E. birthdate picker (custom) */
body.th-date-open {
  overflow: hidden;
}

/* ── iOS-style bottom sheet backdrop ──────────────────────────── */
.th-date-backdrop {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  inset: 0;
  z-index: 1090;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: transparent;
  transition: background 0.28s ease;
  -webkit-backdrop-filter: blur(0px);
  backdrop-filter: blur(0px);
  transition: background 0.28s ease, backdrop-filter 0.28s ease, -webkit-backdrop-filter 0.28s ease;
}

.th-date-backdrop.th-date-show {
  background: rgba(var(--bs-body-color-rgb), 0.38);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

/* ── Sheet ─────────────────────────────────────────────────────── */
.th-date-sheet {
  width: 100%;
  max-width: 36rem;
  background: var(--bs-body-bg);
  border-radius: 1.25rem 1.25rem 0 0;
  box-shadow: 0 -6px 32px rgba(15, 23, 42, 0.18);
  padding-bottom: env(safe-area-inset-bottom, 0.5rem);
  overflow: hidden;
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
}

.th-date-backdrop.th-date-show .th-date-sheet {
  transform: translateY(0);
}

/* Handle bar */
.th-date-sheet::before {
  content: '';
  display: block;
  width: 2.5rem;
  height: 0.28rem;
  border-radius: 99px;
  background: rgba(var(--bs-body-color-rgb), 0.18);
  margin: 0.6rem auto 0;
}

/* ── Header ─────────────────────────────────────────────────────── */
.th-date-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0.5rem 1.25rem 0.75rem;
}

.th-date-title {
  font-weight: 600;
  font-size: 0.9375rem;
  text-align: center;
}

.th-date-btn {
  padding: 0.25rem 0;
  text-decoration: none;
  font-size: 0.9375rem;
}

.th-date-header .th-date-btn:first-child {
  justify-self: start;
  color: var(--bs-secondary-color);
}

.th-date-header .th-date-btn:last-child {
  justify-self: end;
  font-weight: 600;
}

/* ── Body / Columns ─────────────────────────────────────────────── */
.th-date-body {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 0 0.75rem 1rem;
}

.th-date-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.th-date-col-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--bs-secondary-color);
  text-align: center;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── Wheel container ────────────────────────────────────────────── */
.th-date-wheel {
  --th-row-h: 2.75rem;
  position: relative;
  width: 100%;
  height: calc(var(--th-row-h) * 5);
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}

.th-date-wheel:active {
  cursor: grabbing;
}

/* ── Wheel inner (scrollable track) ─────────────────────────────── */
.th-date-wheel-inner {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  will-change: transform;
  user-select: none;
  -webkit-user-select: none;
}

/* ── Each item row ───────────────────────────────────────────────── */
.th-date-wheel-item {
  height: var(--th-row-h, 2.75rem);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.0625rem;
  color: rgba(var(--bs-body-color-rgb), 0.32);
  cursor: pointer;
  transition: color 0.15s ease, font-size 0.15s ease;
  line-height: 1;
}

.th-date-wheel-item--active {
  color: var(--bs-body-color);
  font-weight: 600;
  font-size: 1.125rem;
}

.th-date-wheel-item--pad {
  pointer-events: none;
  cursor: default;
}

/* Selection indicator band */
.th-date-wheel-indicator {
  position: absolute;
  left: 4px; right: 4px;
  top: 50%;
  height: var(--th-row-h);
  transform: translateY(-50%);
  border-top: 1px solid rgba(var(--bs-body-color-rgb), 0.14);
  border-bottom: 1px solid rgba(var(--bs-body-color-rgb), 0.14);
  border-radius: 0.55rem;
  background: rgba(var(--bs-primary-rgb), 0.07);
  pointer-events: none;
  z-index: 1;
}

/* Gradient fades (top/bottom blur effect) */
.th-date-wheel-fade {
  position: absolute;
  left: 0; right: 0;
  height: 36%;
  pointer-events: none;
  z-index: 2;
}

.th-date-wheel-fade--top {
  top: 0;
  background: linear-gradient(to bottom, var(--bs-body-bg) 0%, transparent 100%);
}

.th-date-wheel-fade--bottom {
  bottom: 0;
  background: linear-gradient(to top, var(--bs-body-bg) 0%, transparent 100%);
}


/* ── Custom 24h time picker ─────────────────────────────────────────── */
.th-time-input {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236c757d' stroke-width='1.6' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem;
}

.th-time-panel {
  position: fixed;
  z-index: 1080;
  display: none;
  background: var(--bs-body-bg);
  border: 1px solid rgba(var(--bs-body-color-rgb), 0.15);
  border-radius: 0.75rem;
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.25);
  padding: 0.35rem;
}

.th-time-panel.th-time-show { display: block; }

.th-time-cols {
  display: flex;
  gap: 0.25rem;
}

.th-time-col {
  max-height: calc(2.5rem * 5);
  overflow-y: auto;
  width: 3.25rem;
  scrollbar-width: thin;
}

.th-time-item {
  display: block;
  width: 100%;
  height: 2.5rem;
  border: 0;
  background: transparent;
  color: var(--bs-body-color);
  font-size: 1.0625rem;
  font-variant-numeric: tabular-nums;
  border-radius: 0.5rem;
  cursor: pointer;
}

.th-time-item:hover {
  background: rgba(var(--bs-primary-rgb), 0.10);
}

.th-time-item--active {
  background: var(--bs-primary);
  color: #fff;
  font-weight: 600;
}


@media (min-width: 768px) {
  .th-date-backdrop.th-date-show {
    align-items: center;
  }
  .th-date-sheet {
    border-radius: 1.25rem;
    max-width: 28rem;
  }
}

/* ── prefers-reduced-motion: disable animations for users who need it ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Touch target: ensure all interactive elements meet 44×44px on touch screens ── */
@media (pointer: coarse) {
  /* btn-sm: desktop = ~30px height, touch = 44px minimum */
  .btn-sm {
    min-height: 2.75rem;
  }

  /* Pagination buttons (icon-only small arrows) */
  .pagination .page-link {
    min-height: 2.75rem;
    min-width: 2.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Inline icon buttons (close, delete row, etc.) */
  .btn-close {
    min-width: 2.75rem;
    min-height: 2.75rem;
  }
}

/* ───────────────────────────────────────────────────────────
   Theme toggle (dark / light) — ปุ่มไอคอนใน topbar
   ─────────────────────────────────────────────────────────── */
.theme-toggle {
  flex: 0 0 auto;
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--bs-border-color);
  border-radius: 50%;
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  font-size: 1rem;
  cursor: pointer;
  transition: background var(--transition-standard), color var(--transition-standard),
    border-color var(--transition-standard);
}
.theme-toggle:hover,
.theme-toggle:focus-visible {
  background: var(--bs-secondary-bg);
  color: var(--bs-emphasis-color);
}
.theme-toggle:focus-visible {
  outline: none;
  box-shadow: var(--app-focus);
}

/* ───────────────────────────────────────────────────────────
   Dark theme overrides — เฉพาะจุดที่ hardcode สีไว้ (ไม่ได้ใช้ bs var)
   ส่วนที่ใช้ var(--bs-*) จะปรับเป็นโหมดมืดเองโดย Bootstrap 5.3
   ─────────────────────────────────────────────────────────── */
[data-bs-theme="dark"] {
  color-scheme: dark;
}

/* nav text สว่างขึ้นบนพื้นมืด (เดิม #64748b ทึบ) */
[data-bs-theme="dark"] .app-topbar .nav-item {
  color: var(--bs-secondary-color);
}
/* active nav/title: เดิมเป็น gradient navy ทึบ (#1f2937→#111827) กลืนพื้นมืด
   → ใช้ accent amber โปร่งแทน ให้เด่นและไม่ทึบ */
[data-bs-theme="dark"] .app-topbar .navbar-title.active,
[data-bs-theme="dark"] .app-topbar .nav-item.active,
[data-bs-theme="dark"] .app-topbar .header-approvals.active {
  background: rgba(251, 191, 36, 0.16);
  color: #fcd34d;
  border-color: rgba(251, 191, 36, 0.35);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}
[data-bs-theme="dark"] .app-topbar .nav-item.active:hover,
[data-bs-theme="dark"] .app-topbar .navbar-title.active:hover,
[data-bs-theme="dark"] .app-topbar .header-approvals.active:hover {
  color: #fde68a;
}

/* .table-light / .bg-light = Bootstrap utility สีคงที่ (#f8f9fa) ไม่ปรับตาม dark
   → table header กลายเป็นสว่าง+text สว่าง = มองไม่เห็น. บังคับเป็น surface มืด */
[data-bs-theme="dark"] .table-light,
[data-bs-theme="dark"] .table-light > :not(caption) > * > *,
[data-bs-theme="dark"] .table > thead.table-light th,
[data-bs-theme="dark"] thead.table-light th {
  --bs-table-bg: var(--bs-secondary-bg);
  --bs-table-color: var(--bs-body-color);
  background-color: var(--bs-secondary-bg) !important;
  color: var(--bs-body-color) !important;
}

/* .text-bg-light = bg คงที่สว่าง (#f8f9fa) — บังคับ text เข้มเสมอใน dark
   กัน text-muted/text-dark ทับเป็นสีสว่าง → สว่างบนสว่างมองไม่เห็น */
[data-bs-theme="dark"] .text-bg-light {
  color: #212529 !important;
}

/* .btn-outline-secondary: Bootstrap ใช้ --bs-btn-color คงที่ #6c757d → ทึบ/ดูจางบนพื้นมืด
   ทำให้ text+border สว่างขึ้น (ปุ่ม "กลับหน้าตั้งค่า" ฯลฯ อ่านชัด ไม่ทึบ) */
[data-bs-theme="dark"] .btn-outline-secondary {
  --bs-btn-color: #ced4da;
  --bs-btn-border-color: #6c757d;
  --bs-btn-hover-bg: #6c757d;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-border-color: #6c757d;
  --bs-btn-active-bg: #6c757d;
  --bs-btn-active-border-color: #6c757d;
}

/* live-search status pill: เดิม bg สว่าง (rgba ขาว/ฟ้า/เขียวอ่อน) → tint มืดใน dark */
[data-bs-theme="dark"] .app-live-search__status {
  background: var(--bs-secondary-bg);
  border-color: var(--bs-border-color);
  color: var(--bs-secondary-color);
}
[data-bs-theme="dark"] .app-live-search__status[data-state='loading'] {
  background: rgba(37, 99, 235, 0.18);
  border-color: rgba(37, 99, 235, 0.4);
  color: #93c5fd;
}
[data-bs-theme="dark"] .app-live-search__status[data-state='done'] {
  background: rgba(22, 163, 74, 0.18);
  border-color: rgba(22, 163, 74, 0.4);
  color: #86efac;
}
[data-bs-theme="dark"] .app-live-search__status[data-state='empty'] {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.4);
  color: #fcd34d;
}

/* หน้าโปรไฟล์ (tab คำขอ): cards + badges สีขาว/อ่อน hardcode (profile.css)
   → surface มืด, border โปร่ง, badge tint โปร่ง+text สว่าง */
[data-bs-theme="dark"] .ltl-profile-request-item {
  background: var(--bs-secondary-bg);
  border-color: var(--bs-border-color);
}
[data-bs-theme="dark"] .ltl-profile-request-item__summary,
[data-bs-theme="dark"] .ltl-profile-request-item[open],
[data-bs-theme="dark"] .ltl-profile-request-item[open] .ltl-profile-request-item__summary {
  background: var(--bs-tertiary-bg);
  border-color: var(--bs-border-color);
}
[data-bs-theme="dark"] .ltl-profile-hero-badge {
  background: var(--bs-secondary-bg);
  border-color: var(--bs-border-color);
}
/* ชื่อ user หน้าโปรไฟล์: light ใช้ stroke+เงาขาว (อ่านบน banner) — dark ขาวจ้าจนแสบ
   → เอา stroke/เงาออก ใช้ตัวอักษรนวลอ่านง่าย */
[data-bs-theme="dark"] .ltl-profile-hero-name {
  -webkit-text-stroke: 0;
  text-shadow: none;
  color: #f1f3f5;
}
/* กล่องลายเซ็น: ลายเซ็นเป็นเส้นดำ — dark bg ทำให้กลืน. บังคับพื้นขาวเสมอ
   (ทั้งกล่องแก้ไข + preview ย่อในแท็บข้อมูล) ให้เส้นดำเห็นชัด */
[data-bs-theme="dark"] .ltl-profile-signature-preview {
  background: #ffffff;
  border-color: #cbd5e1;
}
[data-bs-theme="dark"] .ltl-profile-request-status.is-approved,
[data-bs-theme="dark"] .ltl-profile-request-approval__badge.is-approved {
  background: rgba(22, 163, 74, 0.18);
  color: #86efac;
}
[data-bs-theme="dark"] .ltl-profile-request-status.is-rejected,
[data-bs-theme="dark"] .ltl-profile-request-approval__badge.is-rejected,
[data-bs-theme="dark"] .ltl-profile-request-status.is-cancel-pending {
  background: rgba(220, 38, 38, 0.18);
  color: #fca5a5;
}
[data-bs-theme="dark"] .ltl-profile-request-status.is-held,
[data-bs-theme="dark"] .ltl-profile-request-approval__badge.is-held {
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
}

/* ช่องกรอก (input/textarea/select) ใน dark — เดิม bg #212529 เข้มกว่า body
   (#2b3035) → จม/ทึบ, border #495057 จาง. ทำให้ bg อ่อนกว่าพื้น + ขอบ/ตัวอักษรชัด */
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
  --app-surface: #343a40;
  --app-border: #6c757d;
  --app-inset: none;
  background-color: #343a40;
  border-color: #6c757d;
  box-shadow: none;
  color: #f8f9fa;
}
[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
  --app-border: #86b7fe;
  --app-focus: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
  background-color: #3a4046;
  border-color: #86b7fe;
  color: #f8f9fa;
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}
[data-bs-theme="dark"] .form-control::placeholder {
  color: #adb5bd;
  opacity: 1;
}
[data-bs-theme="dark"] .form-control:disabled,
[data-bs-theme="dark"] .form-select:disabled {
  background-color: #2b3035;
  color: #adb5bd;
}

/* เมนู hamburger (panel) บนมือถือ/tablet: bg เป็น gradient ขาว hardcode
   (@media ≤768) → กลืน dark. บังคับเป็น surface มืด + เส้นคั่นโปร่ง */
@media (max-width: 768px) {
  [data-bs-theme="dark"] .app-topbar .app-topbar__panel {
    background: var(--bs-secondary-bg);
    border-color: var(--bs-border-color);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.4);
  }
  [data-bs-theme="dark"] .app-topbar .nav-actions {
    border-top-color: var(--bs-border-color);
  }
}
