/* ไฟล์: css/app.css - สไตล์หลักของ PBIO Service Portal PWA (Design Tokens v1.2.0) */

:root {
  /* Surface Tokens (Dark Slate/Zinc Palette) */
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --bg-main: #070d19;
  --bg-card: rgba(15, 23, 42, 0.85);
  --bg-card-hover: rgba(30, 41, 59, 0.9);
  --bg-modal: #0f172a;
  --bg-inset: rgba(2, 6, 23, 0.7);
  --bg-inset-hover: rgba(15, 23, 42, 0.9);
  --bg-subtle: rgba(30, 41, 59, 0.6);
  --nav-bg: rgba(7, 13, 25, 0.95);
  --bottom-bar-bg: #080e1e;
  --bottom-bar-border: #1e293b;
  --input-bg: #0f172a;
  --input-border: #334155;

  /* Border Tokens */
  --border-card: rgba(51, 65, 85, 0.7);
  --border-subtle: rgba(30, 41, 59, 0.8);
  --border-input: #334155;
  --border-focus: #0284c7;

  /* Typography Tokens */
  --text-main: #f8fafc;
  --text-primary: #ffffff;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;

  /* Component Token: Secondary Button */
  --btn-secondary-bg: #1e293b;
  --btn-secondary-hover-bg: #334155;
  --btn-secondary-text: #e2e8f0;
  --btn-secondary-border: rgba(71, 85, 105, 0.7);

  /* Component Token: Tinted Interactive Buttons (Cyan) */
  --btn-tinted-cyan-bg: rgba(8, 51, 68, 0.7);
  --btn-tinted-cyan-hover-bg: rgba(14, 116, 144, 0.8);
  --btn-tinted-cyan-text: #38bdf8;
  --btn-tinted-cyan-border: rgba(6, 182, 212, 0.35);

  /* Component Token: Tinted Badges */
  --badge-cyan-bg: rgba(6, 182, 212, 0.15);
  --badge-cyan-text: #38bdf8;
  --badge-cyan-border: rgba(6, 182, 212, 0.3);

  --badge-purple-bg: rgba(168, 85, 247, 0.15);
  --badge-purple-text: #d8b4fe;
  --badge-purple-border: rgba(168, 85, 247, 0.3);

  --badge-amber-bg: rgba(245, 158, 11, 0.15);
  --badge-amber-text: #fcd34d;
  --badge-amber-border: rgba(245, 158, 11, 0.3);

  --badge-rose-bg: rgba(244, 63, 94, 0.15);
  --badge-rose-text: #fda4af;
  --badge-rose-border: rgba(244, 63, 94, 0.3);

  /* Card & Banner Surface Tokens */
  --bg-banner-hero: linear-gradient(135deg, #0f172a 0%, #0f172a 50%, #020617 100%);
  --bg-card-emerald: linear-gradient(135deg, rgba(6, 78, 59, 0.4) 0%, rgba(15, 23, 42, 0.9) 60%, #0f172a 100%);
  --bg-card-amber: linear-gradient(135deg, rgba(120, 53, 15, 0.4) 0%, rgba(15, 23, 42, 0.9) 60%, #0f172a 100%);
  --border-card-emerald: rgba(16, 185, 129, 0.4);
  --border-card-amber: rgba(245, 158, 11, 0.4);
}

html.light {
  /* Surface Tokens (Shadcn Light Clean Palette) */
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-modal: #ffffff;
  --bg-inset: #f8fafc;
  --bg-inset-hover: #f1f5f9;
  --bg-subtle: #f1f5f9;
  --nav-bg: rgba(255, 255, 255, 0.94);
  --bottom-bar-bg: #ffffff;
  --bottom-bar-border: #e2e8f0;
  --input-bg: #ffffff;
  --input-border: #cbd5e1;

  /* Border Tokens */
  --border-card: #e2e8f0;
  --border-subtle: #e2e8f0;
  --border-input: #cbd5e1;
  --border-focus: #0284c7;

  /* Typography Tokens */
  --text-main: #0f172a;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;

  /* Component Token: Secondary Button */
  --btn-secondary-bg: #f1f5f9;
  --btn-secondary-hover-bg: #e2e8f0;
  --btn-secondary-text: #334155;
  --btn-secondary-border: #cbd5e1;

  /* Component Token: Tinted Interactive Buttons (Cyan) */
  --btn-tinted-cyan-bg: #e0f2fe;
  --btn-tinted-cyan-hover-bg: #bae6fd;
  --btn-tinted-cyan-text: #0284c7;
  --btn-tinted-cyan-border: #7dd3fc;

  /* Component Token: Tinted Badges */
  --badge-cyan-bg: #f0f9ff;
  --badge-cyan-text: #0284c7;
  --badge-cyan-border: #bae6fd;

  --badge-purple-bg: #faf5ff;
  --badge-purple-text: #7e22ce;
  --badge-purple-border: #e9d5ff;

  --badge-amber-bg: #fffbeb;
  --badge-amber-text: #b45309;
  --badge-amber-border: #fde68a;

  --badge-rose-bg: #fff1f2;
  --badge-rose-text: #be123c;
  --badge-rose-border: #fecdd3;

  /* Card & Banner Surface Tokens */
  --bg-banner-hero: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  --bg-card-emerald: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 60%, #ffffff 100%);
  --bg-card-amber: linear-gradient(135deg, #fffbeb 0%, #fef3c7 60%, #ffffff 100%);
  --border-card-emerald: #86efac;
  --border-card-amber: #fde68a;
}

/* ================= SHADCN DESIGN TOKEN BUTTON UTILITIES ================= */
.token-btn-secondary {
  background-color: var(--btn-secondary-bg, rgba(30, 41, 59, 0.8)) !important;
  color: var(--btn-secondary-text, #cbd5e1) !important;
  border: 1px solid var(--btn-secondary-border, rgba(51, 65, 85, 0.8)) !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}
.token-btn-secondary:hover {
  background-color: var(--btn-secondary-hover-bg, rgba(51, 65, 85, 0.9)) !important;
  color: var(--text-main, #ffffff) !important;
}

html.light .token-btn-secondary {
  background-color: #f1f5f9 !important;
  color: #334155 !important;
  border-color: #cbd5e1 !important;
}
html.light .token-btn-secondary:hover {
  background-color: #e2e8f0 !important;
  color: #0f172a !important;
}

.token-btn-close {
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted, #94a3b8);
  background-color: transparent;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  cursor: pointer;
}
.token-btn-close:hover {
  background-color: var(--bg-inset-hover, rgba(51, 65, 85, 0.5));
  color: var(--text-main, #ffffff);
}
html.light .token-btn-close {
  color: #64748b !important;
  background-color: transparent !important;
}
html.light .token-btn-close i {
  color: #64748b !important;
}
html.light .token-btn-close:hover {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
}
html.light .token-btn-close:hover i {
  color: #0f172a !important;
}

/* Component Token: Inset Card Items & Empty State Containers */
.token-card-item,
.token-empty-state {
  background-color: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(51, 65, 85, 0.7);
  color: #cbd5e1;
}

html.light .token-card-item,
html.light .token-empty-state {
  background-color: #f8fafc !important;
  border-color: #e2e8f0 !important;
  color: #334155 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
}

html.light .token-empty-state i {
  color: #94a3b8 !important;
}

html.light .token-empty-state strong {
  color: #0284c7 !important;
}

/* ================= UNIVERSAL STRUCTURAL SAFETY NET (LIGHT MODE) ================= */
html.light div[class*="from-slate-900"]:not(button):not(a):not(#tab-app-viewer):not(#toastContainer),
html.light div[class*="bg-slate-900"]:not(button):not(a):not(#tab-app-viewer):not(#toastContainer),
html.light div[class*="bg-slate-950"]:not(button):not(a):not(#tab-app-viewer):not(#toastContainer),
html.light div[class*="from-cyan-950"]:not(button):not(a):not(#tab-app-viewer):not(#toastContainer),
html.light div[class*="from-indigo-950"]:not(button):not(a):not(#tab-app-viewer):not(#toastContainer),
html.light div[class*="from-emerald-950"]:not(button):not(a):not(#tab-app-viewer):not(#toastContainer),
html.light div[class*="from-amber-950"]:not(button):not(a):not(#tab-app-viewer):not(#toastContainer),
html.light div[class*="bg-cyan-950"]:not(button):not(a):not(#tab-app-viewer):not(#toastContainer) {
  background-color: #f8fafc !important;
  background-image: none !important;
  border-color: #e2e8f0 !important;
  color: #1e293b !important;
}

html.light div[class*="from-slate-900"]:not(button):not(a) .text-white:not(button):not(a):not(button *):not(a *),
html.light div[class*="bg-slate-900"]:not(button):not(a) .text-white:not(button):not(a):not(button *):not(a *),
html.light div[class*="bg-slate-950"]:not(button):not(a) .text-white:not(button):not(a):not(button *):not(a *),
html.light div[class*="bg-cyan-950"]:not(button):not(a) .text-white:not(button):not(a):not(button *):not(a *) {
  color: #0f172a !important;
}

html.light div[class*="from-slate-900"]:not(button):not(a) .text-slate-400,
html.light div[class*="bg-slate-900"]:not(button):not(a) .text-slate-400,
html.light div[class*="bg-slate-950"]:not(button):not(a) .text-slate-400,
html.light div[class*="bg-cyan-950"]:not(button):not(a) .text-slate-400 {
  color: #64748b !important;
}

html.light div[class*="from-slate-900"]:not(button):not(a) .text-slate-300,
html.light div[class*="bg-slate-900"]:not(button):not(a) .text-slate-300,
html.light div[class*="bg-slate-950"]:not(button):not(a) .text-slate-300,
html.light div[class*="bg-cyan-950"]:not(button):not(a) .text-slate-300 {
  color: #334155 !important;
}


html {
  font-size: 15px;
}

html, body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: 'Prompt', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  line-height: 1.6;
  letter-spacing: 0.015em;
  overscroll-behavior-y: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* บังคับซ่อนแท็บบนในมือถือ 100% เด็ดขาด ไม่ให้มีปุ่มซ้ำซ้อนกับแท็กล่าง */
@media (max-width: 768px) {
  #desktopTabsNav {
    display: none !important;
  }
}

/* แถบเมนูด้านล่างมือถือแบบ แนบชิดขอบล่าง พร้อมพื้นหลังทึบ 100% (Solid) ไม่โปร่งใส ป้องกันตัวอักษรและเนื้อหาซ้อนทับ */
.solid-bottom-bar {
  background-color: #080e1e !important;
  border-top: 1px solid #1e293b !important;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.95) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  opacity: 1 !important;
}

/* Center Prominent Floating Action Button in Mobile Nav */
.center-launcher-item {
  position: relative;
  z-index: 20;
}

.center-floating-pill {
  width: 44px;
  height: 44px;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.5), 0 0 0 3px #080e1e;
  transform: translateY(-8px);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ================= SHADCN UI LIGHT THEME OVERRIDES ================= */
html.light body {
  background-color: #f8fafc !important;
  color: #0f172a !important;
}

html.light .glass-card {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.04) !important;
}

html.light .glass-nav {
  background: rgba(255, 255, 255, 0.94) !important;
  border-bottom: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.04) !important;
}

html.light .glass-dropdown {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05) !important;
}

html.light .glass-dropdown p,
html.light .glass-dropdown span {
  color: #475569 !important;
}

html.light .glass-dropdown #userMenuFullName {
  color: #0f172a !important;
}

html.light .glass-dropdown #userMenuBadge {
  background-color: #f1f5f9 !important;
  color: #334155 !important;
  border: 1px solid #e2e8f0 !important;
}

html.light .glass-dropdown button,
html.light .glass-dropdown a {
  color: #334155 !important;
  background-color: transparent !important;
}

html.light .glass-dropdown button:hover,
html.light .glass-dropdown a:hover {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
}

html.light .glass-dropdown button:hover *,
html.light .glass-dropdown a:hover * {
  color: #0f172a !important;
}

html.light .glass-dropdown button:hover i.fa-id-card-clip,
html.light .glass-dropdown a:hover i.fa-right-to-bracket {
  color: #0284c7 !important;
}

html.light .glass-dropdown button:hover i.fa-calendar-check {
  color: #059669 !important;
}

html.light .glass-dropdown a:hover i.fa-house {
  color: #0284c7 !important;
}

html.light .glass-dropdown #menuItemLogout {
  color: #e11d48 !important;
  border-color: #f1f5f9 !important;
}

html.light .glass-dropdown #menuItemLogout:hover {
  background-color: #fff1f2 !important;
  color: #be123c !important;
}

html.light .glass-dropdown #menuItemLogout:hover * {
  color: #be123c !important;
}

html.light .glass-dropdown .border-slate-800,
html.light .glass-dropdown .border-slate-100 {
  border-color: #f1f5f9 !important;
}

html.light #userProfileChip {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
}

html.light #userProfileChip:hover {
  background-color: #f8fafc !important;
  border-color: #cbd5e1 !important;
}

html.light #userProfileChip #userName {
  color: #0f172a !important;
}

html.light #userProfileChip #userRole {
  color: #0284c7 !important;
}

html.light #desktopTabsNav {
  background: rgba(255, 255, 255, 0.98) !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

html.light .nav-tab {
  color: #334155 !important;
  background-color: transparent !important;
  border-color: transparent !important;
}

html.light .nav-tab * {
  color: #334155 !important;
}

html.light .nav-tab:hover {
  color: #0f172a !important;
  background-color: #f1f5f9 !important;
}

html.light .nav-tab:hover * {
  color: #0f172a !important;
}

html.light .nav-tab.tab-active {
  color: #0284c7 !important;
  background-color: #e0f2fe !important;
  border: 1px solid #7dd3fc !important;
  box-shadow: 0 1px 3px rgba(2, 132, 199, 0.15) !important;
}

html.light .nav-tab.tab-active * {
  color: #0284c7 !important;
}

html.light .solid-bottom-bar {
  background-color: #ffffff !important;
  border-top: 1px solid #e2e8f0 !important;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  opacity: 1 !important;
}

html.light .bottom-nav-item {
  color: #64748b !important;
}

html.light .bottom-nav-item .icon-pill {
  background: #f1f5f9 !important;
  color: #64748b !important;
}

html.light .bottom-nav-item.active {
  color: #0284c7 !important;
}

html.light .bottom-nav-item.active .icon-pill {
  background: #0284c7 !important;
  color: #ffffff !important;
  box-shadow: 0 0 10px rgba(2, 132, 199, 0.4) !important;
}

html.light .center-floating-pill {
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4), 0 0 0 3px #ffffff !important;
}

html.light .bottom-nav-item.active .center-floating-pill {
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.5), 0 0 0 2.5px #0284c7, 0 0 0 5px #ffffff !important;
}

html.light .bottom-nav-item:not(.active) .center-floating-pill {
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%) !important;
  color: #475569 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1), 0 0 0 2px #e2e8f0 !important;
}

html.light .app-icon-label {
  color: #1e293b !important;
}

html.light .app-icon-card:hover .app-icon-box {
  box-shadow: 0 12px 20px -4px rgba(0, 0, 0, 0.15), 0 0 15px rgba(2, 132, 199, 0.25) !important;
}

html.light .app-icon-badge {
  border-color: #ffffff !important;
}

/* Modal Dialogs & Sheets in Light Mode */
html.light .modal-sheet-dialog,
html.light #leaveRequestPanel,
html.light #leaveRequestSheet > div {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  color: #0f172a !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.18) !important;
}

html.light #leaveRequestPanel > div:first-child,
html.light #leaveRequestPanel > form > div:last-child {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
}

html.light .modal-sheet-dialog > .w-10.h-1,
html.light #leaveRequestPanel > .w-10.h-1 {
  background-color: #cbd5e1 !important;
}

html.light .modal-backdrop,
html.light .sheet-backdrop {
  background: rgba(15, 23, 42, 0.45) !important;
}

/* Inset boxes & candidate lists inside modals & tabs */
html.light .modal-sheet-dialog .bg-slate-950,
html.light .modal-sheet-dialog .bg-slate-950\/60,
html.light .modal-sheet-dialog .bg-slate-950\/80,
html.light .modal-sheet-dialog .bg-slate-950\/90,
html.light .modal-sheet-dialog .bg-slate-900\/60,
html.light #leaveRequestPanel .bg-slate-950,
html.light #leaveRequestPanel .bg-slate-950\/60,
html.light #leaveRequestPanel .bg-slate-950\/80,
html.light #leaveRequestPanel .bg-slate-950\/90,
html.light #leaveRequestPanel .bg-slate-800\/90,
html.light #leaveRequestPanel select,
html.light #leaveRequestPanel input,
html.light #leaveRequestPanel textarea,
html.light .modal-sheet-dialog input:not([type="checkbox"]):not([type="radio"]),
html.light .modal-sheet-dialog select,
html.light .modal-sheet-dialog textarea,
html.light #confirmDialogInput,
html.light #deptHeadSearchResults,
html.light #deptHeadSelectedDisplay,
html.light #addPersonDrawer,
html.light #candidatesToAddList,
html.light #deptCurrentMembersList,
html.light #reviewApplicantDetailsBox,
html.light #userProfileBottomSheet .bg-slate-950\/70,
html.light #userProfileBottomSheet .bg-slate-800\/40 {
  background-color: #f8fafc !important;
  border-color: #e2e8f0 !important;
  color: #1e293b !important;
}

html.light #confirmDialogInputLabel {
  color: #334155 !important;
}

html.light #userProfileBottomSheet .text-white {
  color: #0f172a !important;
}
html.light #userProfileBottomSheet .text-slate-400 {
  color: #64748b !important;
}
html.light #userProfileBottomSheet .text-slate-200 {
  color: #1e293b !important;
}
html.light #userProfileBottomSheet .bg-slate-800\/80 {
  background-color: #e2e8f0 !important;
  color: #475569 !important;
}
html.light #userProfileBottomSheet .bg-slate-600\/70 {
  background-color: #cbd5e1 !important;
}

/* Tab Profile UI Enhancements in Light Mode (Vibrant & Rich Aesthetics) */
html.light #tab-profile > .relative.overflow-hidden {
  background: linear-gradient(135deg, #f0fdf4 0%, #e0f2fe 50%, #f8fafc 100%) !important;
  border-color: #7dd3fc !important;
  box-shadow: 0 4px 20px -2px rgba(14, 165, 233, 0.15) !important;
}

html.light #tab-profile .border-slate-900 {
  border-color: #ffffff !important;
}

html.light #profileTabVacRemainingCard,
html.light #tabLeaveVacRemainingCard,
html.light #tab-leave .border-emerald-500\/40:not(#leaveApprovalInboxSection),
html.light #tab-profile .from-emerald-950\/40 {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 50%, #f0fdf4 100%) !important;
  border-color: #6ee7b7 !important;
  box-shadow: 0 4px 14px -2px rgba(16, 185, 129, 0.18) !important;
}

html.light #profileTabVacRemainingCard span.text-emerald-400,
html.light #tabLeaveVacRemainingCard .text-emerald-400,
html.light #tab-profile .from-emerald-950\/40 span.text-emerald-400 {
  color: #14532d !important;
  font-weight: 700 !important;
}

html.light #tabLeaveVacRemainingCard i.fa-umbrella-beach {
  color: #15803d !important;
}

html.light #profileTabVacRemainingCard #profileTabVacRemaining,
html.light #tabLeaveVacRemainingCard #statLeaveVacationRemaining,
html.light #tabLeaveVacRemaining,
html.light #tab-profile .from-emerald-950\/40 #profileTabVacRemaining {
  color: #0f172a !important;
}

html.light #profileTabVacRemainingCard span.text-emerald-300,
html.light #tabLeaveVacRemainingCard span.text-slate-400,
html.light #tab-profile .from-emerald-950\/40 span.text-emerald-300 {
  color: #166534 !important;
  font-weight: 600 !important;
}

html.light #profileTabVacRemainingCard p.text-slate-400,
html.light #tabLeaveVacRemainingCard .text-\[11px\],
html.light #tab-profile .from-emerald-950\/40 p.text-slate-400 {
  color: #1e3a2b !important;
}

html.light #profileTabVacRemainingCard #profileTabVacTotal,
html.light #tabLeaveVacRemainingCard strong,
html.light #tabLeaveVacRemainingCard span.font-semibold,
html.light #tab-profile .from-emerald-950\/40 #profileTabVacTotal {
  color: #052e16 !important;
}

html.light #tab-profile #profileTabRecentLeaves {
  background-color: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

html.light #tab-profile #profileTabRecentLeaves > div:hover {
  background-color: #f1f5f9 !important;
}

/* Tab Leave UI Enhancements in Light Mode (Warm Vibrant Amber Banner) */
html.light #tab-leave .from-amber-950\/40 {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 45%, #ffffff 100%) !important;
  border-color: #fde68a !important;
  box-shadow: 0 4px 20px -2px rgba(245, 158, 11, 0.12) !important;
}

html.light #myLeavesListContainer > div,
html.light #myLeavesListContainer .bg-slate-900\/40,
html.light #myLeavesListContainer .bg-slate-900\/80 {
  background-color: #f8fafc !important;
  border-color: #e2e8f0 !important;
  color: #334155 !important;
}

html.light #myLeavesListContainer i.fa-calendar-xmark {
  color: #94a3b8 !important;
}

html.light #myLeavesListContainer strong {
  color: #0284c7 !important;
}

html.light #leaveApprovalInboxSection {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 40%, #ffffff 100%) !important;
  border-color: #fde68a !important;
  box-shadow: 0 4px 20px -2px rgba(245, 158, 11, 0.12) !important;
}

html.light #leaveApprovalInboxSection h3 {
  color: #78350f !important;
}

html.light #leaveApprovalInboxSection .token-card-item {
  background-color: #ffffff !important;
  border-color: #fde68a !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
}

html.light #leaveApprovalInboxList > div {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
}

/* Leave Review Modal in Light Mode (High Contrast & Legibility) */
html.light #leaveReviewModal .modal-sheet-dialog {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.2) !important;
}

html.light #leaveReviewModal .border-b,
html.light #leaveReviewModal .border-t {
  border-color: #f1f5f9 !important;
}

html.light #reviewApplicantDetailsBox {
  background-color: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

html.light #hrApproverSelectionContainer {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%) !important;
  border-color: #bae6fd !important;
  box-shadow: 0 2px 8px -1px rgba(14, 165, 233, 0.08) !important;
}

html.light #hrApproverSelectionContainer label {
  color: #0369a1 !important;
}

html.light #hrApproverSelectionContainer label i {
  color: #0284c7 !important;
}

html.light #hrApproverSelectionContainer p {
  color: #334155 !important;
}

html.light #leaveReviewApproverSelect {
  background-color: #ffffff !important;
  border-color: #93c5fd !important;
  color: #0f172a !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

html.light #leaveReviewModal label {
  color: #1e293b !important;
}

html.light #leaveReviewComment {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

html.light #leaveReviewComment::placeholder {
  color: #94a3b8 !important;
}

/* In-App Embedded Webview Shell in Light Mode */
html.light #tab-app-viewer #embeddedAppLoader {
  background-color: rgba(248, 250, 252, 0.96) !important;
}

html.light #tab-app-viewer #embeddedAppLoader h4 {
  color: #0f172a !important;
}

html.light #tab-app-viewer #embeddedAppLoader p {
  color: #64748b !important;
}

/* Secondary / Close / Cancel buttons in Light Mode */
html.light button.bg-slate-800,
html.light .modal-sheet-dialog button[onclick*="close"],
html.light #leaveRequestPanel button[onclick*="close"],
html.light #leaveRequestPanel button[type="button"]:not([class*="bg-emerald"]):not([class*="bg-cyan"]):not([class*="bg-rose"]):not([class*="bg-amber"]) {
  background-color: #f1f5f9 !important;
  color: #334155 !important;
  border: 1px solid #cbd5e1 !important;
}

html.light button.bg-slate-800:hover,
html.light .modal-sheet-dialog button[onclick*="close"]:hover,
html.light #leaveRequestPanel button[onclick*="close"]:hover {
  background-color: #e2e8f0 !important;
  color: #0f172a !important;
}

/* Toast Notifications in Light Mode */
html.light #toastContainer > div {
  background-color: #ffffff !important;
  color: #0f172a !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.06) !important;
}

html.light #toastContainer > div span {
  color: #0f172a !important;
}

/* Mobile Pull-to-Refresh Indicator in Light Mode */
html.light #pullToRefreshIndicator > div {
  background-color: #ffffff !important;
  border-color: #bae6fd !important;
  color: #0284c7 !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1) !important;
}

html.light #pullToRefreshIndicator > div i,
html.light #pullToRefreshIndicator > div span {
  color: #0284c7 !important;
}

/* Form Inputs in Light Mode */
html.light input,
html.light select,
html.light textarea {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

html.light input::placeholder,
html.light textarea::placeholder {
  color: #94a3b8 !important;
}

html.light input:focus,
html.light select:focus,
html.light textarea:focus {
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2) !important;
}

html.light input[type="date"]::-webkit-calendar-picker-indicator {
  filter: none !important;
}

/* General Headings & Labels in Light Mode */
html.light h1,
html.light h2,
html.light h3,
html.light h4,
html.light label {
  color: #0f172a !important;
}

/* Text color helpers in light mode (WCAG AAA High Contrast) - EXCLUDE buttons and colored action pills */
html.light .text-white:not(button):not(a):not(button *):not(a *):not(.center-floating-pill):not(.center-floating-pill *):not([class*="bg-emerald-"]):not([class*="bg-amber-"]):not([class*="bg-cyan-"]):not([class*="bg-rose-"]):not([class*="bg-blue-"]):not([class*="bg-purple-"]):not([class*="bg-violet-"]):not([class*="bg-indigo-"]):not([class*="bg-teal-"]):not([class*="bg-sky-"]) {
  color: #0f172a !important;
}

html.light .text-slate-100,
html.light .text-slate-200 {
  color: #1e293b !important;
}

html.light .text-slate-300 {
  color: #334155 !important;
}

html.light .text-slate-400 {
  color: #64748b !important;
}

html.light .text-slate-500 {
  color: #64748b !important;
}

html.light .text-slate-600 {
  color: #94a3b8 !important;
}

/* High Contrast Accent Colors in Light Mode */
html.light .text-cyan-300,
html.light .text-cyan-400 {
  color: #0284c7 !important;
}

html.light .text-emerald-300,
html.light .text-emerald-400 {
  color: #047857 !important;
}

html.light .text-amber-300,
html.light .text-amber-400 {
  color: #b45309 !important;
}

html.light .text-purple-300,
html.light .text-purple-400 {
  color: #6b21a8 !important;
}

html.light .text-rose-300,
html.light .text-rose-400 {
  color: #be123c !important;
}

html.light .text-blue-300,
html.light .text-blue-400 {
  color: #1d4ed8 !important;
}

/* CRITICAL: Crisp White Text & Icons ONLY for Solid/Gradient Action Buttons in Light Mode (100% UNIFIED) */
html.light button.bg-emerald-600,
html.light button.bg-emerald-600 *,
html.light button.bg-emerald-500,
html.light button.bg-emerald-500 *,
html.light button.bg-cyan-600,
html.light button.bg-cyan-600 *,
html.light button.bg-cyan-500,
html.light button.bg-cyan-500 *,
html.light button.bg-blue-600,
html.light button.bg-blue-600 *,
html.light button.bg-amber-600,
html.light button.bg-amber-600 *,
html.light button.bg-amber-500,
html.light button.bg-amber-500 *,
html.light button.bg-rose-600,
html.light button.bg-rose-600 *,
html.light button.bg-teal-600,
html.light button.bg-teal-600 *,
html.light button.bg-purple-600,
html.light button.bg-purple-600 *,
html.light button.bg-violet-600,
html.light button.bg-violet-600 *,
html.light button.bg-indigo-600,
html.light button.bg-indigo-600 *,
html.light button.bg-sky-600,
html.light button.bg-sky-600 *,
html.light button[class*="from-"],
html.light button[class*="from-"] *,
html.light a[class*="from-"],
html.light a[class*="from-"] *,
html.light #btnReviewTabPending.bg-amber-600,
html.light #btnReviewTabPending.bg-amber-600 *,
html.light #btnReviewTabSchedule.bg-amber-600,
html.light #btnReviewTabSchedule.bg-amber-600 *,
html.light #btnReviewTabHistory.bg-amber-600,
html.light #btnReviewTabHistory.bg-amber-600 *,
html.light .center-floating-pill,
html.light .center-floating-pill *,
html.light .app-icon-badge,
html.light .app-icon-badge *,
html.light .bottom-nav-item.active .icon-pill,
html.light .bottom-nav-item.active .icon-pill * {
  color: #ffffff !important;
}

/* Tinted Desktop Tabs & Tinted Action Buttons in Light Mode (Deep Accent Text) */
html.light .nav-tab.tab-active,
html.light .nav-tab.tab-active *,
html.light .token-btn-cyan,
html.light .token-btn-cyan *,
html.light button[class*="bg-cyan-500/"],
html.light button[class*="bg-cyan-500/"] *,
html.light button[class*="bg-cyan-950/"],
html.light button[class*="bg-cyan-950/"] *,
html.light a[class*="bg-cyan-500/"],
html.light a[class*="bg-cyan-500/"] *,
html.light a[class*="bg-cyan-950/"],
html.light a[class*="bg-cyan-950/"] * {
  color: #0284c7 !important;
}

html.light .token-btn-secondary,
html.light .token-btn-secondary *,
html.light button.bg-slate-800,
html.light button.bg-slate-800 *,
html.light button[class*="bg-slate-800/"],
html.light button[class*="bg-slate-800/"] * {
  color: #334155 !important;
}

/* Tinted Badges in Light Mode (High Contrast & Saturated Colors) */
html.light .bg-cyan-500\/10,
html.light .bg-cyan-500\/15,
html.light .bg-cyan-500\/20,
html.light .bg-cyan-500\/25,
html.light .bg-cyan-500\/30 {
  background-color: #f0f9ff !important;
  border-color: #7dd3fc !important;
  color: #0369a1 !important;
  font-weight: 700 !important;
}
html.light .bg-cyan-500\/10 *,
html.light .bg-cyan-500\/15 *,
html.light .bg-cyan-500\/20 *,
html.light .bg-cyan-500\/25 *,
html.light .bg-cyan-500\/30 * {
  color: #0369a1 !important;
}

html.light .bg-emerald-500\/10,
html.light .bg-emerald-500\/15,
html.light .bg-emerald-500\/20,
html.light .bg-emerald-500\/25,
html.light .bg-emerald-500\/30 {
  background-color: #ecfdf5 !important;
  border-color: #4ade80 !important;
  color: #14532d !important;
  font-weight: 700 !important;
}
html.light .bg-emerald-500\/10 *,
html.light .bg-emerald-500\/15 *,
html.light .bg-emerald-500\/20 *,
html.light .bg-emerald-500\/25 *,
html.light .bg-emerald-500\/30 * {
  color: #14532d !important;
}

html.light .bg-amber-500\/10,
html.light .bg-amber-500\/15,
html.light .bg-amber-500\/20,
html.light .bg-amber-500\/25,
html.light .bg-amber-500\/30 {
  background-color: #fffbeb !important;
  border-color: #f59e0b !important;
  color: #78350f !important;
  font-weight: 700 !important;
}
html.light .bg-amber-500\/10 *,
html.light .bg-amber-500\/15 *,
html.light .bg-amber-500\/20 *,
html.light .bg-amber-500\/25 *,
html.light .bg-amber-500\/30 * {
  color: #78350f !important;
}

html.light .bg-purple-500\/10,
html.light .bg-purple-500\/15,
html.light .bg-purple-500\/20,
html.light .bg-purple-500\/25,
html.light .bg-purple-500\/30 {
  background-color: #faf5ff !important;
  border-color: #c084fc !important;
  color: #581c87 !important;
  font-weight: 700 !important;
}
html.light .bg-purple-500\/10 *,
html.light .bg-purple-500\/15 *,
html.light .bg-purple-500\/20 *,
html.light .bg-purple-500\/25 *,
html.light .bg-purple-500\/30 * {
  color: #581c87 !important;
}

/* ================= SUBSYSTEMS MANAGEMENT MODAL (SHADCN LIGHT THEME) ================= */
html.light #systemsModal .modal-sheet-dialog {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
}

html.light #systemsModal .border-slate-800,
html.light #systemsModal .border-slate-700 {
  border-color: #e2e8f0 !important;
}

html.light #systemsModal .bg-slate-950,
html.light #systemsModal .bg-slate-950\/60,
html.light #systemsModal .bg-slate-950\/70,
html.light #systemsModal .bg-slate-950\/80,
html.light #systemsModal .bg-slate-900,
html.light #systemsModal .bg-slate-900\/80,
html.light #systemsModal .bg-slate-900\/90 {
  background-color: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

html.light #systemsModal #systemsListWrapper > div {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05) !important;
}

html.light #systemsModal #systemsListWrapper > div:hover {
  border-color: #cbd5e1 !important;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05) !important;
}

html.light #systemsModal input,
html.light #systemsModal select {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

html.light #systemsModal .sys-filter-btn {
  background-color: #f1f5f9 !important;
  border-color: #e2e8f0 !important;
  color: #475569 !important;
}

html.light #systemsModal .sys-filter-btn[class*="text-cyan"] {
  background-color: #e0f2fe !important;
  border-color: #7dd3fc !important;
  color: #0284c7 !important;
}

html.light .bg-rose-500\/10,
html.light .bg-rose-500\/15,
html.light .bg-rose-500\/20,
html.light .bg-rose-500\/25,
html.light .bg-rose-500\/30 {
  background-color: #fff1f2 !important;
  border-color: #fb7185 !important;
  color: #9f1239 !important;
  font-weight: 700 !important;
}
html.light .bg-rose-500\/10 *,
html.light .bg-rose-500\/15 *,
html.light .bg-rose-500\/20 *,
html.light .bg-rose-500\/25 *,
html.light .bg-rose-500\/30 * {
  color: #9f1239 !important;
}

html.light .bg-blue-500\/10,
html.light .bg-blue-500\/15,
html.light .bg-blue-500\/20,
html.light .bg-blue-500\/25,
html.light .bg-blue-500\/30 {
  background-color: #eff6ff !important;
  border-color: #60a5fa !important;
  color: #1e40af !important;
  font-weight: 700 !important;
}
html.light .bg-blue-500\/10 *,
html.light .bg-blue-500\/15 *,
html.light .bg-blue-500\/20 *,
html.light .bg-blue-500\/25 *,
html.light .bg-blue-500\/30 * {
  color: #1e40af !important;
}

/* Badges in Dark Mode (High Contrast & Sharp Borders) */
.bg-cyan-500\/15, .bg-cyan-500\/20, .bg-cyan-500\/25 {
  border-color: rgba(6, 182, 212, 0.45) !important;
  color: #38bdf8 !important;
  font-weight: 600;
}
.bg-emerald-500\/15, .bg-emerald-500\/20, .bg-emerald-500\/25 {
  border-color: rgba(16, 185, 129, 0.45) !important;
  color: #4ade80 !important;
  font-weight: 600;
}
.bg-amber-500\/15, .bg-amber-500\/20, .bg-amber-500\/25 {
  border-color: rgba(245, 158, 11, 0.45) !important;
  color: #fbbf24 !important;
  font-weight: 600;
}
.bg-purple-500\/15, .bg-purple-500\/20, .bg-purple-500\/25 {
  border-color: rgba(168, 85, 247, 0.45) !important;
  color: #c084fc !important;
  font-weight: 600;
}
.bg-rose-500\/15, .bg-rose-500\/20, .bg-rose-500\/25 {
  border-color: rgba(244, 63, 94, 0.45) !important;
  color: #fb7185 !important;
  font-weight: 600;
}
.bg-blue-500\/15, .bg-blue-500\/20, .bg-blue-500\/25 {
  border-color: rgba(59, 130, 246, 0.45) !important;
  color: #60a5fa !important;
  font-weight: 600;
}

/* Tinted Action Buttons & Inset Fallbacks in Light Mode (e.g. ปุ่ม "บุคลากร" ในหน้ากลุ่มงาน) */
html.light .bg-cyan-950,
html.light .bg-cyan-950\/20,
html.light .bg-cyan-950\/40,
html.light .bg-cyan-950\/60,
html.light .bg-cyan-950\/80 {
  background-color: #e0f2fe !important;
  border-color: #7dd3fc !important;
  color: #0284c7 !important;
}

html.light .bg-cyan-950\/60:hover,
html.light .bg-cyan-950\/40:hover,
html.light .bg-cyan-950\/80:hover {
  background-color: #bae6fd !important;
  color: #0369a1 !important;
}

html.light .bg-purple-950,
html.light .bg-purple-950\/40,
html.light .bg-purple-950\/60 {
  background-color: #f3e8ff !important;
  border-color: #d8b4fe !important;
  color: #7e22ce !important;
}

html.light .bg-amber-950,
html.light .bg-amber-950\/40,
html.light .bg-amber-950\/60 {
  background-color: #fef3c7 !important;
  border-color: #fde68a !important;
  color: #92400e !important;
}

html.light .bg-rose-950,
html.light .bg-rose-950\/40,
html.light .bg-rose-950\/60 {
  background-color: #ffe4e6 !important;
  border-color: #fecdd3 !important;
  color: #be123c !important;
}

/* Background overrides in Light Mode */
html.light .bg-slate-900,
html.light .bg-slate-950,
html.light .bg-\[\#070d19\] {
  background-color: #ffffff !important;
}

html.light .bg-slate-950\/60,
html.light .bg-slate-950\/70,
html.light .bg-slate-950\/80,
html.light .bg-slate-950\/90,
html.light .bg-slate-900\/60,
html.light .bg-slate-900\/70,
html.light .bg-slate-900\/80,
html.light .bg-slate-900\/90 {
  background-color: #f8fafc !important;
  border-color: #e2e8f0 !important;
  color: #1e293b !important;
}

html.light .bg-slate-800 {
  background-color: #f1f5f9 !important;
  color: #334155 !important;
}

html.light .bg-slate-800\/70,
html.light .bg-slate-800\/80,
html.light .bg-slate-800\/90 {
  background-color: #f1f5f9 !important;
  color: #334155 !important;
}

html.light .border-slate-800,
html.light .border-slate-800\/80,
html.light .border-slate-800\/90,
html.light .border-slate-700,
html.light .border-slate-700\/60,
html.light .border-slate-700\/70,
html.light .border-slate-700\/80 {
  border-color: #e2e8f0 !important;
}

html.light .divide-slate-800 > :not([hidden]) ~ :not([hidden]),
html.light .divide-slate-800\/60 > :not([hidden]) ~ :not([hidden]),
html.light .divide-slate-800\/80 > :not([hidden]) ~ :not([hidden]) {
  border-color: #e2e8f0 !important;
}

/* Design Token Utility Classes */
.token-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-card);
  color: var(--text-primary);
}

.token-inset-row {
  background-color: var(--bg-inset);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.token-btn-secondary {
  background-color: var(--btn-secondary-bg);
  color: var(--btn-secondary-text);
  border: 1px solid var(--btn-secondary-border);
  transition: all 0.15s ease-in-out;
}

.token-btn-secondary:hover {
  background-color: var(--btn-secondary-hover-bg);
}

.token-btn-cyan {
  background-color: var(--btn-tinted-cyan-bg);
  color: var(--btn-tinted-cyan-text);
  border: 1px solid var(--btn-tinted-cyan-border);
  transition: all 0.15s ease-in-out;
}

.token-btn-cyan:hover {
  background-color: var(--btn-tinted-cyan-hover-bg);
}

/* Universal Tab Header Banners for Light Mode (Auto-applies to ANY current or future tab) */
html.light .tab-pane > .relative.overflow-hidden,
html.light #tab-profile > .relative.overflow-hidden,
html.light #tab-dashboard > .relative.overflow-hidden,
html.light #tab-leave > .relative.overflow-hidden,
html.light #tab-settings > .relative.overflow-hidden {
  background: var(--bg-banner-hero, linear-gradient(135deg, #ffffff 0%, #f8fafc 100%)) !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05) !important;
}

/* ================= UNIVERSAL SEMANTIC SURFACES & GRADIENT SAFETY NET ================= */
/* Automatically converts all non-button dark gradients into clean, high-contrast light surfaces */
html.light div[class*="from-slate-900"]:not(button):not(a):not([role="button"]),
html.light div[class*="from-slate-950"]:not(button):not(a):not([role="button"]),
html.light div[class*="from-blue-900"]:not(button):not(a):not([role="button"]),
html.light section[class*="from-slate-900"]:not(button):not(a):not([role="button"]) {
  background: var(--bg-banner-hero, linear-gradient(135deg, #ffffff 0%, #f8fafc 100%)) !important;
  border-color: #e2e8f0 !important;
}

/* Emerald tinted surfaces (e.g. Vacation cards, duty sections) */
html.light div[class*="from-emerald-950"]:not(button):not(a):not([role="button"]),
html.light section[class*="from-emerald-950"]:not(button):not(a):not([role="button"]) {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}
html.light div[class*="from-emerald-950"]:not(button):not(a):not([role="button"]) .text-white:not(button):not(a):not(button *):not(a *) {
  color: #0f172a !important;
}
html.light div[class*="from-emerald-950"]:not(button):not(a):not([role="button"]) [class*="text-emerald-"]:not(button):not(a):not(button *):not(a *) {
  color: #059669 !important;
}
html.light div[class*="from-emerald-950"]:not(button):not(a):not([role="button"]) [class*="text-slate-"]:not(button):not(a):not(button *):not(a *) {
  color: #64748b !important;
}

/* Amber tinted surfaces (e.g. Approval inbox, warning cards) */
html.light div[class*="from-amber-950"]:not(button):not(a):not([role="button"]),
html.light section[class*="from-amber-950"]:not(button):not(a):not([role="button"]) {
  background: var(--bg-card-amber, linear-gradient(135deg, #fffbeb 0%, #fef3c7 45%, #ffffff 100%)) !important;
  border-color: #fde68a !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}
html.light div[class*="from-amber-950"]:not(button):not(a):not([role="button"]) .text-white:not(button):not(a):not(button *):not(a *) {
  color: #0f172a !important;
}
html.light div[class*="from-amber-950"]:not(button):not(a):not([role="button"]) [class*="text-amber-"]:not(button):not(a):not(button *):not(a *) {
  color: #b45309 !important;
}
html.light div[class*="from-amber-950"]:not(button):not(a):not([role="button"]) [class*="text-slate-"]:not(button):not(a):not(button *):not(a *) {
  color: #64748b !important;
}

/* Universal opacity catchers for slate surfaces */
html.light [class*="bg-slate-950/"]:not(button):not(a):not([role="button"]),
html.light [class*="bg-slate-900/"]:not(button):not(a):not([role="button"]) {
  background-color: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

html.light [class*="bg-slate-800/"]:not(button):not(a):not([role="button"]) {
  background-color: #f1f5f9 !important;
  border-color: #e2e8f0 !important;
}

/* Ambient glow blobs in light mode */
html.light .tab-pane .blur-3xl {
  opacity: 0.2 !important;
}

html.light #leaveApprovalInboxSection {
  background: linear-gradient(135deg, #fff1f2 0%, #ffe4e6 100%) !important;
  border-color: #fecdd3 !important;
}

/* Table styling in Light Mode */
html.light thead {
  background-color: #f1f5f9 !important;
  color: #475569 !important;
  border-color: #e2e8f0 !important;
}

html.light tbody tr:hover {
  background-color: #f8fafc !important;
}

/* Shadcn UI Theme Segmented Toggle Pill */
.shadcn-theme-segment {
  display: inline-flex;
  align-items: center;
  padding: 4px;
  background-color: #0f172a;
  border: 1px solid #334155;
  border-radius: 14px;
  gap: 2px;
}

html.light .shadcn-theme-segment {
  background-color: #f1f5f9;
  border-color: #e2e8f0;
}

.theme-segment-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

html.light .theme-segment-btn {
  color: #64748b;
}

.theme-segment-btn:hover {
  color: #f8fafc;
}

html.light .theme-segment-btn:hover {
  color: #0f172a;
}

.theme-segment-btn.active {
  background-color: #0284c7;
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

html.light .theme-segment-btn.active {
  background-color: #ffffff;
  color: #0284c7;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
}

.bottom-nav-item.active .center-floating-pill {
  background: linear-gradient(135deg, #38bdf8 0%, #0284c7 50%, #0369a1 100%);
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.65), 0 0 0 2.5px #38bdf8, 0 0 0 5px #080e1e;
  transform: translateY(-10px) scale(1.06);
  color: #ffffff;
}

.bottom-nav-item:not(.active) .center-floating-pill {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: #94a3b8;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5), 0 0 0 2px rgba(51, 65, 85, 0.6);
  transform: translateY(-5px);
}

/* Native Mobile Bottom Sheet Dialog on Small Screens */
@media (max-width: 640px) {
  .modal-backdrop,
  .sheet-backdrop {
    align-items: flex-end !important;
    padding: 0 !important;
  }

  .modal-sheet-dialog {
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    border-top-left-radius: 28px !important;
    border-top-right-radius: 28px !important;
    max-height: 92vh !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    animation: slideUpBottom 0.28s cubic-bezier(0.32, 0.72, 0, 1) forwards !important;
  }

  @keyframes slideUpBottom {
    from {
      transform: translateY(100%);
    }
    to {
      transform: translateY(0);
    }
  }
}

/* ================= MOBILE APP LAUNCHER ICONS (สไตล์ไอคอนแอปพลิเคชันมือถือ) ================= */
.app-icon-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px 8px;
}

@media (min-width: 640px) {
  .app-icon-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 22px 16px;
  }
}

@media (min-width: 1024px) {
  .app-icon-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 28px 20px;
  }
}

.app-icon-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  text-decoration: none;
  background: transparent;
  border: none;
  cursor: grab;
  outline: none;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  padding: 8px 4px;
  border-radius: 20px;
  position: relative;
  touch-action: pan-y;
}

.app-icon-card:active {
  cursor: grabbing;
}

.app-icon-card.is-dragging {
  opacity: 0.35 !important;
  transform: scale(0.9) !important;
  filter: grayscale(40%);
}

.app-icon-card.drag-over {
  transform: scale(1.1) !important;
  background: rgba(56, 189, 248, 0.16) !important;
  box-shadow: 0 0 0 2px #38bdf8, 0 8px 20px rgba(56, 189, 248, 0.25) !important;
}

/* Floating touch ghost element for mobile touch drag */
.touch-drag-ghost {
  position: fixed !important;
  pointer-events: none !important;
  z-index: 999999 !important;
  transform: translate(-50%, -50%) scale(1.18) !important;
  transition: none !important;
  opacity: 0.95;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.85));
  margin: 0 !important;
}

.app-icon-card:hover .app-icon-box {
  transform: translateY(-3px);
  box-shadow: 0 12px 24px -4px rgba(0, 0, 0, 0.6), 0 0 20px rgba(56, 189, 248, 0.35);
}

.app-icon-box {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 25px;
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.22);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: visible;
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .app-icon-box {
    width: 68px;
    height: 68px;
    border-radius: 20px;
    font-size: 28px;
  }
  .app-icon-box svg {
    width: 32px;
    height: 32px;
    max-width: 32px;
    max-height: 32px;
  }
}

.app-icon-box svg {
  width: 28px;
  height: 28px;
  max-width: 28px;
  max-height: 28px;
  stroke: currentColor;
}

/* Glass shine overlay on top of app icon */
.app-icon-box::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 48%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.32) 0%, rgba(255, 255, 255, 0.02) 100%);
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
  pointer-events: none;
}

.app-icon-label {
  margin-top: 7px;
  font-size: 11.5px;
  font-weight: 500;
  color: #f1f5f9;
  line-height: 1.25;
  max-width: 76px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  transition: color 0.15s ease;
}

@media (min-width: 640px) {
  .app-icon-label {
    font-size: 12.5px;
    max-width: 90px;
    margin-top: 8px;
  }
}

.app-icon-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  background: #ef4444;
  color: #ffffff;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.7);
  border: 2px solid #0f172a;
  z-index: 20;
  pointer-events: none;
  white-space: nowrap;
}

@media (min-width: 640px) {
  .app-icon-badge {
    top: -6px;
    right: -6px;
    min-width: 22px;
    height: 22px;
    font-size: 11px;
    padding: 0 6px;
  }
}

/* Glassmorphism Classes */
.glass-card {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(51, 65, 85, 0.7);
}

.glass-nav {
  background: rgba(7, 13, 25, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(51, 65, 85, 0.8);
}

.glass-dropdown {
  background: rgba(15, 23, 42, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(71, 85, 105, 0.8);
}

/* Custom Scrollbar สำหรับ Desktop */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.6);
}
::-webkit-scrollbar-thumb {
  background: rgba(51, 65, 85, 0.8);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(71, 85, 105, 1);
}

/* ซ่อน Scrollbar บนมือถือ 100% เลื่อนหน้าจอได้เนียนตา ไม่มีแถบเกะกะ */
@media (max-width: 768px) {
  * {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }
  *::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Modal & Sheet Transitions */
.modal-backdrop {
  background: rgba(2, 6, 23, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.sheet-backdrop {
  background: rgba(2, 6, 23, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: opacity 0.25s ease;
  overscroll-behavior: contain;
}

/* ล็อกหน้าจอพื้นหลัง 100% ไม่ให้เลื่อนหรือโยกไปมาระหว่างเปิดโมดอล/ฟอร์ม */
body.modal-open {
  position: fixed !important;
  width: 100% !important;
  height: 100% !important;
  overflow: hidden !important;
  touch-action: none !important;
}

/* Tab indicator for Desktop Top Nav */
.tab-active {
  color: #38bdf8 !important;
  border-bottom-color: #38bdf8 !important;
  background: rgba(56, 189, 248, 0.12) !important;
}

/* Mobile Bottom Nav Items - ขยายปุ่มให้ใหญ่ขึ้น กดง่าย สัมผัสถนัดมือ */
/* Mobile Bottom Nav Items - ขยายปุ่มให้ใหญ่ขึ้น กดง่าย สัมผัสถนัดมือ อ่านสบายตา */
.bottom-nav-item {
  color: #94a3b8;
  transition: transform 0.12s ease-in-out, color 0.12s ease-in-out;
  touch-action: manipulation;
  height: 56px !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3px 0 !important;
}

/* เพิ่ม Effect ยุบตัวเมื่อใช้นิ้วแตะ (Touch Feedback) */
.bottom-nav-item:active {
  transform: scale(0.92);
}

.bottom-nav-item.active {
  color: #38bdf8 !important;
  font-weight: 700;
}

.bottom-nav-item.active .icon-pill {
  background: #0284c7 !important;
  color: #ffffff !important;
  box-shadow: 0 0 12px rgba(14, 165, 233, 0.6);
  transform: translateY(-1px);
}

.bottom-nav-item .icon-pill {
  width: 48px;
  height: 28px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #151f32;
  color: #94a3b8;
  font-size: 15px;
  margin-bottom: 2px;
  transition: all 0.15s ease-in-out;
}

.bottom-nav-item span {
  font-size: 11.5px !important;
  line-height: 1.2;
  font-weight: 500;
}

/* ================= ACCESSIBILITY & THAI TYPOGRAPHY (อ่านง่าย ชัดเจน สำหรับผู้สูงอายุ) ================= */
/* ขยายตัวหนังสือขนาดจิ๋ว (8px, 9px, 10px) ให้อ่านได้สบายตา ชัดเจนทุกสระและวรรณยุกต์ */
[class*="text-[8px]"], [class*="text-[9px]"] {
  font-size: 11.5px !important;
  line-height: 1.45 !important;
}

[class*="text-[10px]"] {
  font-size: 12.5px !important;
  line-height: 1.5 !important;
}

[class*="text-[11px]"] {
  font-size: 13.5px !important;
  line-height: 1.5 !important;
}

/* ปรับขนาดช่องกรอกข้อมูลและ Dropdown ให้อ่านง่าย นิ้วกดง่าย ไม่ต้องเพ่ง และไม่ล้นจอ */
input, select, textarea {
  font-size: 14.5px !important;
  box-sizing: border-box !important;
  max-width: 100% !important;
  min-width: 0 !important;
}

@media (max-width: 640px) {
  input, select, textarea {
    font-size: 16px !important; /* ป้องกัน iOS/Android Auto Zoom เมื่อแตะพิมพ์ */
  }
}

/* ป้องกันช่องเลือกวันที่ (input[type=date]) กว้างเกินจอเด็ดขาด */
input[type="date"] {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

input[type="date"]::-webkit-date-and-time-value {
  text-align: left;
  min-height: 1.4em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  padding: 0 4px;
  margin: 0;
  filter: invert(0.85);
  flex-shrink: 0;
}

/* ================= AUTHENTICATION-GATED DISPLAY RULES ================= */
/* ซ่อนแถบนำทางและแท็บทั้งหมดโดยค่าเริ่มต้นอย่างเด็ดขาด จนกว่าจะยืนยันตัวตนสำเร็จ */
#desktopTabsNav {
  display: none !important;
}

#desktopTabsNav.auth-visible {
  display: none !important;
}

@media (min-width: 768px) {
  #desktopTabsNav.auth-visible {
    display: block !important;
  }
}

#mobileBottomNav {
  display: none !important;
}

#mobileBottomNav.auth-visible {
  display: block !important;
}

@media (min-width: 768px) {
  #mobileBottomNav.auth-visible {
    display: none !important;
  }
}

/* เฉพาะ .tab-pane.hidden เพื่อความปลอดภัยของ Auth-Gated โดยไม่ทับ Tailwind responsive classes เช่น hidden md:block */
.tab-pane.hidden {
  display: none !important;
}

/* ================= TRUE SEAMLESS EDGE-TO-EDGE IN-APP WEBVIEW ================= */
#tab-app-viewer {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  height: 100dvh !important;
  z-index: 9999 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background-color: #020617 !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

#tab-app-viewer .embedded-top-bar {
  background-color: rgba(15, 23, 42, 0.98) !important;
  border-bottom: 1px solid rgba(51, 65, 85, 0.8) !important;
  padding-top: max(env(safe-area-inset-top, 0px), 16px) !important;
  padding-bottom: 10px !important;
  padding-left: max(env(safe-area-inset-left, 0px), 12px) !important;
  padding-right: max(env(safe-area-inset-right, 0px), 14px) !important;
  box-sizing: border-box !important;
}

#tab-app-viewer iframe {
  width: 100% !important;
  height: 100% !important;
  border: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 0 !important;
  background-color: #ffffff !important;
}

/* Light Mode for Webview Shell */
html.light #tab-app-viewer {
  background-color: #ffffff !important;
}

html.light #tab-app-viewer .embedded-top-bar {
  background-color: rgba(255, 255, 255, 0.98) !important;
  border-bottom: 1px solid #e2e8f0 !important;
  padding-top: max(env(safe-area-inset-top, 0px), 16px) !important;
  padding-bottom: 10px !important;
  padding-left: max(env(safe-area-inset-left, 0px), 12px) !important;
  padding-right: max(env(safe-area-inset-right, 0px), 14px) !important;
  box-sizing: border-box !important;
}

html.light #tab-app-viewer #embeddedAppLoader {
  background-color: #ffffff !important;
}

html.light #tab-app-viewer #embeddedAppLoader h4 {
  color: #0f172a !important;
}

html.light #tab-app-viewer #embeddedAppLoader p {
  color: #64748b !important;
}

/* Role-based Visibility Control (Admin vs Regular User) */
body.is-regular-user .admin-only {
  display: none !important;
}

body.is-admin .regular-user-only {
  display: none !important;
}

body.is-regular-user .admin-disabled {
  pointer-events: none !important;
  opacity: 0.6 !important;
}

/* 3-Tab Symmetric Grid for Regular Users on Mobile Bottom Nav */
body.is-regular-user #mobileBottomNav .grid {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

/* Applicant Leave Approved Notification Alert */
.leave-approved-alert-card {
  background: linear-gradient(to right, rgba(6, 78, 59, 0.45), rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.95));
  border: 1px solid rgba(16, 185, 129, 0.4);
}
html.light .leave-approved-alert-card {
  background: linear-gradient(to right, #ecfdf5, #ffffff, #ffffff) !important;
  border-color: #a7f3d0 !important;
  box-shadow: 0 4px 15px -3px rgba(16, 185, 129, 0.12) !important;
}
html.light .leave-approved-alert-card .alert-title {
  color: #065f46 !important;
}
html.light .leave-approved-alert-card .alert-desc {
  color: #1e293b !important;
}
html.light .leave-approved-alert-card .alert-meta {
  color: #475569 !important;
}

/* User Scope Segmented Tabs (Shadcn UI Standard) */
.user-scope-tab {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  -webkit-user-select: none;
  user-select: none;
}
.user-scope-tab.active {
  background-color: rgba(6, 182, 212, 0.2) !important;
  color: #67e8f9 !important;
  border-color: rgba(6, 182, 212, 0.4) !important;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
html.light .user-scope-tab.active {
  background-color: #ecfeff !important;
  color: #0e7490 !important;
  border-color: #a5f3fc !important;
}
html.light .user-scope-tab:not(.active) {
  color: #64748b !important;
}
html.light .user-scope-tab:not(.active):hover {
  color: #0f172a !important;
  background-color: #f1f5f9 !important;
}

/* External Personnel Banner & Cards in Light Mode */
.surface-banner-cyan {
  background-color: rgba(8, 47, 73, 0.35) !important;
  border: 1px solid rgba(6, 182, 212, 0.35) !important;
}

html.light .surface-banner-cyan,
html.light #personnelModalExternalBanner,
html.light #profileExternalNoticeCard {
  background: linear-gradient(135deg, #ecfeff 0%, #f0fdfa 100%) !important;
  border-color: #a5f3fc !important;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05) !important;
}

html.light #personnelModalExternalBanner #personnelModalHospitalName,
html.light #profileExternalNoticeCard h3 {
  color: #0e7490 !important;
}

html.light #personnelModalExternalBanner .text-slate-400,
html.light #profileExternalNoticeCard .text-slate-400 {
  color: #475569 !important;
}

html.light #personnelModalExternalBanner #personnelModalHospitalCode {
  color: #0284c7 !important;
}

html.light #personnelModalExternalBanner span[class*="bg-cyan-500"] {
  background-color: #cffafe !important;
  color: #0891b2 !important;
  border-color: #a5f3fc !important;
}

html.light #personnelModalExternalBanner button {
  background-color: #e0f2fe !important;
  color: #0284c7 !important;
  border-color: #bae6fd !important;
}

html.light #personnelModalExternalBanner button:hover {
  background-color: #0284c7 !important;
  color: #ffffff !important;
}

/* Select options consistency across platforms */
html.light select option {
  background-color: #ffffff !important;
  color: #0f172a !important;
}

html.dark select option {
  background-color: #0f172a !important;
  color: #f8fafc !important;
}

/* Systems Management Tab in Light Mode */
html.light .sys-manage-row {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05) !important;
}
html.light .sys-manage-row:hover {
  border-color: #cbd5e1 !important;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08) !important;
}
html.light .sys-drag-handle,
html.light .sys-manage-row div[class*="bg-slate-900"],
html.light .sys-manage-row div[class*="bg-slate-950"] {
  background-color: #f8fafc !important;
  border-color: #e2e8f0 !important;
  color: #64748b !important;
}
html.light .sys-manage-row h4 {
  color: #0f172a !important;
}
html.light .sys-manage-row span[class*="bg-slate-900"] {
  background-color: #f1f5f9 !important;
  color: #334155 !important;
  border-color: #e2e8f0 !important;
}
html.light .sys-manage-row button[class*="bg-slate-900"] {
  background-color: #f1f5f9 !important;
  color: #475569 !important;
  border-color: #e2e8f0 !important;
}
html.light .sys-manage-row button[class*="bg-slate-900"]:hover {
  background-color: #e2e8f0 !important;
  color: #0f172a !important;
}
html.light #tab-systems .bg-slate-950,
html.light #tab-systems .bg-slate-950\/70,
html.light #tab-systems .bg-slate-950\/80,
html.light #tab-systems .bg-slate-900\/60,
html.light #tab-systems .bg-slate-900\/90 {
  background-color: #f8fafc !important;
  border-color: #e2e8f0 !important;
}
html.light #tab-systems input[type="text"]:not([class*="bg-transparent"]) {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}
html.light #tab-systems input[type="text"]:not([class*="bg-transparent"]):focus {
  border-color: #06b6d4 !important;
}

/* Active Organization Cards in Profile & Admin Modal */
.profile-org-card {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

html.light .profile-org-card.is-active-org {
  background: linear-gradient(135deg, #ecfeff 0%, #f0fdfa 100%) !important;
  border-color: #a5f3fc !important;
  box-shadow: 0 1px 3px 0 rgba(6, 182, 212, 0.1) !important;
}

html.light .profile-org-card.is-active-org strong {
  color: #0891b2 !important;
}

html.light .profile-org-card:not(.is-active-org) {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
}

html.light .profile-org-card:not(.is-active-org):hover {
  background-color: #f8fafc !important;
  border-color: #cbd5e1 !important;
}

html.light .profile-org-card:not(.is-active-org) strong {
  color: #0f172a !important;
}

html.light .profile-org-card .text-slate-400,
html.light .profile-org-card .text-slate-300 {
  color: #475569 !important;
}

html.light #profileActiveOrgSection {
  background: #ffffff !important;
  border-color: #bae6fd !important;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05) !important;
}

html.light #profileActiveOrgSection h3 {
  color: #0369a1 !important;
}

html.light #profileActiveOrgSection p {
  color: #475569 !important;
}

html.light #profileActiveOrgSection .border-slate-800 {
  border-color: #e2e8f0 !important;
}

html.light #personnelActiveOrgWrapper {
  background-color: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

html.light #personnelActiveOrgWrapper label {
  color: #0f172a !important;
}

html.light #personnelActiveOrgWrapper p {
  color: #64748b !important;
}

html.light #personnelActiveOrgBadge {
  color: #0891b2 !important;
}

html.light #personnelMainOrgLabel {
  color: #059669 !important;
}

html.light #personnelActiveOrgNotice[class*="bg-amber"] {
  background-color: #fffbeb !important;
  color: #b45309 !important;
  border-color: #fde68a !important;
}

html.light #personnelActiveOrgNotice[class*="bg-emerald"] {
  background-color: #ecfdf5 !important;
  color: #047857 !important;
  border-color: #a7f3d0 !important;
}

/* User Pagination Component (Light Mode & Shadcn Consistency) */
html.light #userPagination {
  color: #64748b;
}

html.light #userPagination #currentPageNum {
  color: #0f172a !important;
}

html.light #userPageSelect {
  background-color: #f1f5f9 !important;
  color: #0284c7 !important;
  border-color: #cbd5e1 !important;
}

html.light #userPageSelect:hover {
  background-color: #e2e8f0 !important;
}

html.light #btnFirstPage,
html.light #btnLastPage,
html.light #btnPrevPage,
html.light #btnNextPage {
  background-color: #f8fafc !important;
  color: #475569 !important;
  border-color: #cbd5e1 !important;
}

html.light #btnFirstPage:hover:not(:disabled),
html.light #btnLastPage:hover:not(:disabled),
html.light #btnPrevPage:hover:not(:disabled),
html.light #btnNextPage:hover:not(:disabled) {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
  border-color: #94a3b8 !important;
}

html.light .btn-page-num:not(.bg-cyan-500\/20) {
  background-color: #f8fafc !important;
  color: #475569 !important;
  border-color: #cbd5e1 !important;
}

html.light .btn-page-num:not(.bg-cyan-500\/20):hover {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
  border-color: #94a3b8 !important;
}

html.light .btn-page-num.bg-cyan-500\/20 {
  background-color: #e0f2fe !important;
  color: #0284c7 !important;
  border-color: #38bdf8 !important;
}

/* User Scope Switcher (Light & Dark Theme Consistency) */
.user-scope-tab .scope-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
}

.user-scope-tab.active .scope-badge {
  background-color: rgba(6, 182, 212, 0.25) !important;
  color: #a5f3fc !important;
  border: 1px solid rgba(6, 182, 212, 0.35) !important;
}

.user-scope-tab:not(.active) .scope-badge {
  background-color: rgba(15, 23, 42, 0.6) !important;
  color: #94a3b8 !important;
  border: 1px solid rgba(51, 65, 85, 0.6) !important;
}

html.light .user-scope-tab:not(.active) {
  color: #64748b !important;
  background-color: transparent !important;
  border-color: transparent !important;
}

html.light .user-scope-tab:not(.active):hover {
  color: #0f172a !important;
  background-color: #f1f5f9 !important;
}

html.light .user-scope-tab.active {
  background-color: #e0f2fe !important;
  color: #0284c7 !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 1px 3px rgba(2, 132, 199, 0.15) !important;
}

html.light .user-scope-tab.active .scope-badge {
  background-color: #bae6fd !important;
  color: #0369a1 !important;
  border-color: #7dd3fc !important;
}

html.light .user-scope-tab:not(.active) .scope-badge {
  background-color: #e2e8f0 !important;
  color: #475569 !important;
  border-color: #cbd5e1 !important;
}

/* ================= TEAM LEAVE CALENDAR STYLES ================= */
.team-cal-cell {
  min-height: 84px;
  padding: 6px;
  background-color: rgba(2, 6, 23, 0.4);
  transition: background-color 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
  position: relative;
}

@media (min-width: 640px) {
  .team-cal-cell {
    min-height: 104px;
    padding: 8px;
  }
}

.team-cal-cell:hover {
  background-color: rgba(30, 41, 59, 0.7);
}

.team-cal-cell.is-other-month {
  opacity: 0.35;
  background-color: rgba(2, 6, 23, 0.65);
}

.team-cal-cell.is-weekend {
  background-color: rgba(15, 23, 42, 0.5);
}

.team-cal-cell.is-today {
  background-color: rgba(6, 182, 212, 0.08);
  box-shadow: inset 0 0 0 1.5px rgba(6, 182, 212, 0.7);
}

.team-cal-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 5px;
  border-radius: 6px;
  font-size: 10px;
  line-height: 1.2;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Light Mode Overrides for Team Calendar */
html.light .team-cal-cell {
  background-color: #ffffff;
}

html.light .team-cal-cell:hover {
  background-color: #f1f5f9;
}

html.light .team-cal-cell.is-other-month {
  opacity: 0.4;
  background-color: #f8fafc;
}

html.light .team-cal-cell.is-weekend {
  background-color: #f8fafc;
}

html.light .team-cal-cell.is-today {
  background-color: #f0fdfa;
  box-shadow: inset 0 0 0 1.5px #0284c7;
}

html.light #teamCalendarDaysGrid {
  border-color: #e2e8f0 !important;
}

html.light #teamCalendarDaysGrid > div {
  border-color: #e2e8f0 !important;
}


/* ================= INPUT PLACEHOLDER STYLING (FADED HINTS IN BOTH THEMES) ================= */
input::placeholder,
textarea::placeholder {
  color: #64748b !important;
  opacity: 0.72 !important;
  font-weight: 400 !important;
}

html.light input::placeholder,
html.light textarea::placeholder {
  color: #94a3b8 !important;
  opacity: 0.85 !important;
  font-weight: 400 !important;
}

/* ================= DESKTOP & WIDE-SCREEN UI SCALING (ขนาดใหญ่ อ่านง่าย กดสะดวกบนหน้าจอคอมพิวเตอร์) ================= */
@media (min-width: 1024px) {
  html {
    font-size: 16.5px;
  }

  /* ขยายตัวอักษรขนาดเล็กให้อ่านชัดเจนบนจอคอมพิวเตอร์ */
  [class*="text-[8px]"], [class*="text-[9px]"] {
    font-size: 12.5px !important;
    line-height: 1.5 !important;
  }

  [class*="text-[10px]"] {
    font-size: 13.5px !important;
    line-height: 1.5 !important;
  }

  [class*="text-[11px]"] {
    font-size: 14.5px !important;
    line-height: 1.55 !important;
  }

  /* ขยายปุ่มแท็บเมนูนำทางด้านบน (Desktop Navigation Bar) */
  .nav-tab {
    padding: 0.65rem 1.25rem !important;
    font-size: 0.95rem !important;
    border-radius: 0.9rem !important;
  }

  /* ขยายช่องกรอกข้อมูล ปุ่มเลือก และปุ่มกดให้มีขนาดใหญ่ใช้งานง่ายด้วยเมาส์ */
  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea {
    font-size: 15.5px !important;
    padding-top: 0.65rem !important;
    padding-bottom: 0.65rem !important;
  }

  /* ขยายไอคอนระบบงาน (App Launcher) บนจอใหญ่ */
  .app-icon-box {
    width: 74px !important;
    height: 74px !important;
    border-radius: 22px !important;
    font-size: 30px !important;
  }

  .app-icon-label {
    font-size: 14px !important;
    max-width: 120px !important;
  }

  /* ขยายตารางปฏิทินการลากลุ่มงานให้เห็นชื่อและสถานะชัดเจน */
  .team-cal-cell {
    min-height: 122px;
    padding: 10px;
  }

  .team-cal-chip {
    font-size: 12px;
    padding: 3.5px 7px;
    border-radius: 8px;
    gap: 5px;
  }

  /* ขยายความกว้างของหน้าต่าง Modal บนหน้าจอ Desktop */
  .modal-sheet-dialog.max-w-md {
    max-width: 34rem !important;
  }

  .modal-sheet-dialog.max-w-lg {
    max-width: 40rem !important;
  }

  .modal-sheet-dialog.max-w-xl {
    max-width: 46rem !important;
  }
}

@media (min-width: 1280px) {
  html {
    font-size: 17.5px;
  }

  /* ขยายความกว้าง Container หลักให้ใช้พื้นที่หน้าจอกว้างได้อย่างคุ้มค่า */
  .max-w-7xl {
    max-width: 1440px !important;
  }

  .app-icon-box {
    width: 80px !important;
    height: 80px !important;
    border-radius: 24px !important;
    font-size: 32px !important;
  }

  .app-icon-label {
    font-size: 14.5px !important;
    max-width: 132px !important;
  }

  .team-cal-cell {
    min-height: 132px;
    padding: 12px;
  }

  .team-cal-chip {
    font-size: 12.5px;
    padding: 4px 8px;
  }
}

@media (min-width: 1536px) {
  html {
    font-size: 18px;
  }

  .max-w-7xl {
    max-width: 1560px !important;
  }
}


/* ============================================================================
   UNIVERSAL SHADCN SKELETON LOADING & PAGINATION CONTROLS (LIGHT & DARK MODE)
   ============================================================================ */

@keyframes skeletonDiagonalSweep {
  0% {
    transform: translate3d(-120%, 0, 0) skewX(-18deg);
  }
  100% {
    transform: translate3d(220%, 0, 0) skewX(-18deg);
  }
}

@keyframes skeletonSoftBreath {
  0%, 100% {
    opacity: 0.92;
  }
  50% {
    opacity: 0.62;
  }
}

@keyframes skeletonCardFadeIn {
  0% {
    opacity: 0;
    transform: translateY(4px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes contentSmoothReveal {
  0% {
    opacity: 0;
    transform: translateY(5px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.skeleton-shimmer {
  position: relative;
  overflow: hidden;
  background-color: rgba(51, 65, 85, 0.42);
  border-radius: 9999px;
  animation: skeletonSoftBreath 2.2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  isolation: isolate;
}

.skeleton-shimmer::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 65%;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(148, 163, 184, 0.14) 35%,
    rgba(226, 232, 240, 0.24) 50%,
    rgba(148, 163, 184, 0.14) 65%,
    rgba(255, 255, 255, 0) 100%
  );
  will-change: transform;
  animation: skeletonDiagonalSweep 1.75s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

html.light-theme .skeleton-shimmer {
  background-color: rgba(203, 213, 225, 0.55);
}

html.light-theme .skeleton-shimmer::after {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.55) 35%,
    rgba(255, 255, 255, 0.88) 50%,
    rgba(255, 255, 255, 0.55) 65%,
    rgba(255, 255, 255, 0) 100%
  );
}

.skeleton-card-wrap {
  background-color: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(51, 65, 85, 0.45);
  border-radius: 1rem;
  padding: 1rem;
  animation: skeletonCardFadeIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
}

html.light-theme .skeleton-card-wrap {
  background-color: rgba(255, 255, 255, 0.92);
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
}

.token-card-item {
  animation: contentSmoothReveal 0.26s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Pagination Bar for Leave Review / Assigned Duties / History */
.leave-pagination-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 0.75rem;
  margin-top: 0.5rem;
  border-top: 1px solid rgba(51, 65, 85, 0.6);
}

html.light-theme .leave-pagination-bar {
  border-top-color: #e2e8f0;
}

.leave-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.625rem;
  border-radius: 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  transition: all 0.15s ease;
  background-color: rgba(30, 41, 59, 0.85);
  color: #cbd5e1;
  border: 1px solid rgba(71, 85, 105, 0.7);
  cursor: pointer;
}

.leave-page-btn:hover:not(:disabled) {
  background-color: rgba(51, 65, 85, 0.95);
  color: #ffffff;
  border-color: rgba(100, 116, 139, 0.9);
}

.leave-page-btn.is-active {
  background: linear-gradient(135deg, #d97706 0%, #ea580c 100%);
  color: #ffffff !important;
  border-color: rgba(245, 158, 11, 0.6);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.35);
}

.leave-page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

html.light-theme .leave-page-btn {
  background-color: #f8fafc;
  color: #334155;
  border-color: #cbd5e1;
}

html.light-theme .leave-page-btn:hover:not(:disabled) {
  background-color: #e2e8f0;
  color: #0f172a;
}

/* Fiscal Year Selector in Light Mode */
html.light-theme #leaveFiscalYearSelect,
html.light #leaveFiscalYearSelect {
  color: #0f172a !important;
}

html.light-theme #leaveFiscalYearSelect option,
html.light #leaveFiscalYearSelect option {
  background-color: #ffffff !important;
  color: #0f172a !important;
}

/* ================= MULTI-SELECT PERMISSION FILTER (POPOVER & TRIGGER) ================= */
#permFilterDropdownMenu {
  background-color: #0f172a !important;
  border: 1px solid #334155 !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.08) !important;
  opacity: 1 !important;
}

#btnPermFilterDropdown {
  background-color: rgba(15, 23, 42, 0.9);
  border-color: rgba(51, 65, 85, 0.8);
  color: #f1f5f9;
}

html.light #btnPermFilterDropdown,
html.light-theme #btnPermFilterDropdown {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

html.light #btnPermFilterDropdown .text-slate-300,
html.light-theme #btnPermFilterDropdown .text-slate-300,
html.light #btnPermFilterDropdown .text-slate-200,
html.light-theme #btnPermFilterDropdown .text-slate-200 {
  color: #0f172a !important;
}

html.light #permFilterDropdownMenu,
html.light-theme #permFilterDropdownMenu {
  background-color: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.08) !important;
}

html.light #permFilterDropdownMenu span,
html.light-theme #permFilterDropdownMenu span,
html.light #permFilterDropdownMenu p,
html.light-theme #permFilterDropdownMenu p,
html.light #permFilterDropdownMenu label,
html.light-theme #permFilterDropdownMenu label {
  color: #1e293b !important;
}

html.light #permFilterDropdownMenu .text-slate-400,
html.light-theme #permFilterDropdownMenu .text-slate-400,
html.light #permFilterDropdownMenu .text-slate-500,
html.light-theme #permFilterDropdownMenu .text-slate-500 {
  color: #64748b !important;
}

html.light #permFilterDropdownMenu .border-slate-800,
html.light-theme #permFilterDropdownMenu .border-slate-800,
html.light #permFilterDropdownMenu .border-slate-700,
html.light-theme #permFilterDropdownMenu .border-slate-700,
html.light #permFilterDropdownMenu .border-slate-700\/60,
html.light-theme #permFilterDropdownMenu .border-slate-700\/60 {
  border-color: #e2e8f0 !important;
}

html.light #permFilterDropdownMenu .bg-slate-800,
html.light-theme #permFilterDropdownMenu .bg-slate-800,
html.light #permFilterDropdownMenu .bg-slate-800\/40,
html.light-theme #permFilterDropdownMenu .bg-slate-800\/40 {
  background-color: #f1f5f9 !important;
  border-color: #e2e8f0 !important;
  color: #1e293b !important;
}

html.light #permFilterDropdownMenu label:hover,
html.light-theme #permFilterDropdownMenu label:hover {
  background-color: #f8fafc !important;
}

html.light #permFilterDropdownMenu button[onclick*="close"],
html.light-theme #permFilterDropdownMenu button[onclick*="close"] {
  background-color: #f1f5f9 !important;
  color: #334155 !important;
}
