/* ซ่อน sidebar และ topbar nav groups (ใช้ menu grid modal แทน) */
.fi-sidebar { display: none !important; }
.fi-topbar-nav-groups { display: none !important; }
.fi-main-ctn { margin-inline-start: 0 !important; }

/* ให้ user menu อยู่เหนือ quick access bar ที่อยู่ใต้ topbar */
.fi-topbar-end,
.fi-topbar .fi-user-menu,
.fi-topbar .fi-dropdown.fi-user-menu {
    position: relative;
    z-index: 60;
}

.fi-dropdown-panel {
    z-index: 70 !important;
}

.dark .fi-dropdown-list-item,
.dark .fi-dropdown-list-item .fi-dropdown-list-item-label,
.dark .fi-dropdown-list-item .fi-icon {
    color: var(--app-strong-text) !important;
}

.dark .fi-dropdown-list-item .fi-badge,
.dark .fi-dropdown-list-item [class*="text-gray-"] {
    color: var(--app-muted-text) !important;
}

.dark .fi-dropdown-list-item:hover,
.dark .fi-dropdown-list-item:focus-visible {
    background-color: var(--app-surface-bg-hover) !important;
    color: var(--app-strong-text) !important;
}

.dark .boss-crosslinks {
    background: var(--app-surface-bg) !important;
    box-shadow: inset 0 0 0 1px var(--app-surface-border);
}

.dark .boss-crosslinks-label,
.dark .boss-crosslinks-divider {
    color: var(--app-muted-text) !important;
}

.dark .boss-crosslinks-link {
    color: var(--app-muted-text) !important;
    border: 1px solid transparent;
}

.dark .boss-crosslinks-link:hover {
    background: var(--app-surface-bg-hover) !important;
    color: var(--app-strong-text) !important;
    box-shadow: inset 0 0 0 1px var(--app-surface-border);
}

.dark .boss-crosslinks-link-active {
    background: var(--app-surface-raised) !important;
    color: var(--app-strong-text) !important;
    box-shadow: inset 0 0 0 1px var(--app-surface-border-strong), inset 0 -2px 0 0 var(--app-primary), 0 10px 24px -20px var(--app-focus-shadow) !important;
    filter: none !important;
}

.dark .boss-crosslinks-link-active .fi-icon,
.dark .boss-crosslinks-link-active svg {
    color: inherit !important;
}

.dark .fc-tabs {
    border-bottom-color: var(--app-surface-border) !important;
}

.dark .fc-tab {
    color: var(--app-muted-text) !important;
    border-radius: 0.5rem 0.5rem 0 0;
}

.dark .fc-tab:hover {
    background: var(--app-surface-bg-hover) !important;
    color: var(--app-strong-text) !important;
}

.dark .fc-tab-active {
    background: var(--app-surface-raised) !important;
    color: var(--app-strong-text) !important;
    box-shadow: inset 0 0 0 1px var(--app-surface-border), inset 0 -2px 0 0 var(--app-primary) !important;
    filter: none !important;
}

.dark .nav-tabs {
    border-bottom-color: var(--app-surface-border) !important;
}

.dark .nav-tabs .nav-link {
    color: var(--app-muted-text) !important;
    border: 1px solid transparent;
    border-radius: 0.5rem 0.5rem 0 0;
}

.dark .nav-tabs .nav-link:hover {
    background: var(--app-surface-bg-hover) !important;
    border-color: var(--app-surface-border) !important;
    color: var(--app-strong-text) !important;
}

.dark .nav-tabs .nav-link.active {
    background: var(--app-surface-raised) !important;
    border-color: var(--app-surface-border-strong) !important;
    color: var(--app-strong-text) !important;
    box-shadow: inset 0 -2px 0 0 var(--app-primary), 0 10px 24px -20px var(--app-focus-shadow) !important;
}

.dark .ds-quick-btn:hover,
.dark .fc-filter-btn:hover,
.dark .fc-pager-btn:hover:not(:disabled) {
    background: var(--app-surface-bg-hover) !important;
    border-color: var(--app-surface-border-strong) !important;
    color: var(--app-strong-text) !important;
}

.dark .ds-quick-btn.active,
.dark .fc-filter-active,
.dark .fc-pager-active {
    background: var(--app-primary) !important;
    border-color: var(--app-primary) !important;
    color: #ffffff !important;
    box-shadow: 0 10px 24px -20px var(--app-focus-shadow), inset 0 0 0 1px rgba(255,255,255,0.08) !important;
}

.boss-filter-toggle {
    background: transparent !important;
    color: #374151 !important;
    border: 1px solid transparent !important;
}

.boss-filter-toggle:hover,
.boss-filter-toggle:focus-visible {
    background: #f3f4f6 !important;
    border-color: #e5e7eb !important;
    color: #111827 !important;
}

.boss-filter-toggle-active {
    background: rgba(245, 158, 11, 0.12) !important;
    border-color: rgba(245, 158, 11, 0.22) !important;
    color: #b45309 !important;
}

.boss-filter-panel {
    background: #ffffff !important;
}

.dark .boss-filter-toggle {
    background: transparent !important;
    color: var(--app-muted-text) !important;
    border-color: transparent !important;
}

.dark .boss-filter-toggle:hover,
.dark .boss-filter-toggle:focus-visible {
    background: var(--app-surface-bg-hover) !important;
    border-color: var(--app-surface-border) !important;
    color: var(--app-strong-text) !important;
}

.dark .boss-filter-toggle-active {
    background: var(--app-surface-raised) !important;
    border-color: var(--app-surface-border-strong) !important;
    color: var(--app-strong-text) !important;
    box-shadow: inset 0 -2px 0 0 var(--app-primary), 0 10px 24px -20px var(--app-focus-shadow) !important;
}

.dark .boss-filter-panel {
    background: var(--app-surface-bg) !important;
}

.dark .fi-page [style*="color: #111827"],
.dark .fi-page [style*="color:#111827"],
.dark .fi-page [style*="color: #374151"],
.dark .fi-page [style*="color:#374151"],
.dark .fi-page [style*="color: #495057"],
.dark .fi-page [style*="color:#495057"] {
    color: var(--app-strong-text) !important;
}

.dark .fi-page [style*="color: #6b7280"],
.dark .fi-page [style*="color:#6b7280"],
.dark .fi-page [style*="color: #9ca3af"],
.dark .fi-page [style*="color:#9ca3af"] {
    color: var(--app-muted-text) !important;
}

/* บังคับใช้ font Sarabun ทั้งระบบ - ยกเว้น Font Awesome icons */
:root {
    --font-family: "Sarabun", ui-sans-serif, system-ui, sans-serif !important;
}
body, html,
.fi-layout, .fi-layout *:not(.fa):not(.fas):not(.far):not(.fab):not([class*="fa-"]),
.fi-sidebar, .fi-sidebar *:not(.fa):not(.fas):not(.far):not(.fab):not([class*="fa-"]),
.fi-main, .fi-main *:not(.fa):not(.fas):not(.far):not(.fab):not([class*="fa-"]),
.fi-topbar, .fi-topbar *:not(.fa):not(.fas):not(.far):not(.fab):not([class*="fa-"]),
[class*="fi-"]:not(.fa):not(.fas):not(.far):not(.fab):not([class*="fa-"]) {
    font-family: "Sarabun", ui-sans-serif, system-ui, sans-serif !important;
}
/* ทำให้ตารางแคบลง - ความสูงเซลล์ข้อความ 46px */
.fi-ta-text:not(.fi-inline),
.fi-size-sm.fi-ta-text-item.fi-ta-text {
    font-size: 0.875rem !important;
    line-height: 1.375 !important;
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
    min-height: 46px !important;
    display: flex !important;
    align-items: center !important;
}

/* alignEnd / alignCenter ต้องทำงานร่วมกับ flex ด้านบน */
.fi-ta-text.fi-align-end {
    justify-content: flex-end !important;
    text-align: end !important;
}
.fi-ta-text.fi-align-center {
    justify-content: center !important;
    text-align: center !important;
}

/* header cell + data cell alignment */
.fi-ta-header-cell.fi-align-end {
    text-align: end !important;
}
.fi-ta-header-cell.fi-align-center {
    text-align: center !important;
}
.fi-ta-cell.fi-align-end .fi-ta-col {
    justify-content: flex-end !important;
    text-align: end !important;
}
.fi-ta-cell.fi-align-center .fi-ta-col {
    justify-content: center !important;
    text-align: center !important;
}
.fi-ta-cell:has(.fi-ta-actions),
.fi-ta-cell:has(.fi-ta-record-checkbox) {
    padding-top: 0.7rem !important;
    padding-bottom: 0.7rem !important;
}
/* Header ของตาราง */
.fi-ta-header-cell {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
}

/* Form fields แคบลง */
.fi-fo-field-wrp {
    margin-bottom: 0.75rem !important;
}
.fi-input-wrp {
    min-height: 2.25rem !important;
}
/* Section แคบลง */
.fi-section-content {
    padding: 0.75rem !important;
}
/* Header ของหน้าแคบลง */
.fi-header {
    padding-top: 0.5rem !important;
    padding-bottom: 0.75rem !important;
    margin-bottom: 0.5rem !important;
    margin-top: 0 !important;
    padding-bottom: 0 !important;
}
/* Pagination แคบลง */
.fi-ta-pagination {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
}
/* Main content แคบลง */
.fi-main {
    padding: 0.75rem !important;
    padding-top: 0 !important;
}
@media (min-width: 640px) {
    .fi-main {
        padding: 1rem !important;
        padding-top: 0 !important;
    }
}
/* Main container */
.fi-main-ctn {
    gap: 0.5rem !important;
    padding-top: 0 !important;
}
/* ลดช่องว่างระหว่าง header กับ content */
.fi-page > * + * {
    margin-top: 0.5rem !important;
}
.fi-header + * {
    margin-top: 0.5rem !important;
}
/* Table container */
.fi-ta-ctn {
    gap: 0 !important;
    margin-top: 0 !important;
}
.fi-ta-header-ctn {
    padding: 0.5rem 0.75rem !important;
}
/* ลด padding ของ search box */
.fi-ta-header-toolbar {
    padding: 0.5rem !important;
}
/* ลดระยะห่างใน card/section */
.fi-section {
    gap: 0 !important;
}
.fi-section-header {
    padding: 0.5rem 0.75rem !important;
}
/* ลดช่องว่างหลัก */
.fi-body {
    padding-top: 0 !important;
}
.fi-ta-content-ctn {
    border-top: 0 !important;
}
/* ลด gap ของ page */
.fi-page {
    gap: 0.5rem !important;
}
/* Breadcrumb */
.fi-breadcrumbs {
    margin-bottom: 0.25rem !important;
    padding-top: 0 !important;
    margin-top: 0 !important;
}
/* ลดช่องว่างระหว่าง header กับ table */
.fi-resource-page > .fi-page > * {
    margin-top: 0.25rem !important;
}
.fi-wi-stats-overview,
.fi-ta,
.fi-section {
    margin-top: 0.5rem !important;
}
/* ลด padding ใน table container */
.fi-ta-ctn > div:first-child {
    padding: 0.5rem !important;
}
/* ลดช่องว่างระหว่าง topbar กับ content */
.fi-topbar + div {
    padding-top: 0 !important;
}
/* ลด margin-top ของ main content */
.fi-main > div:first-child {
    margin-top: 0 !important;
    padding-top: 0 !important;
}
/* ลดช่องว่างระหว่าง header กับ table card */
.fi-header {
    margin-bottom: 0.5rem !important;
    padding-bottom: 0 !important;
}
/* ลด gap ของ simple page */
.fi-simple-page {
    padding-top: 0.5rem !important;
}
/* ลดช่องว่างบน body */
.fi-body > div {
    gap: 0 !important;
}
/* ช่องว่างระหว่าง topbar กับ breadcrumb */
.fi-main {
    padding-top: 0.25rem !important;
}
/* ช่องว่างระหว่าง header กับ table */
.fi-ta {
    margin-top: 0.25rem !important;
}
/* ลด padding ของ header wrapper */
.fi-header-heading {
    padding: 0 !important;
}
/* ลด gap ภายใน page */
[class*="fi-page"] > div {
    gap: 0.25rem !important;
}
/* ลดช่องว่างด้านบนสุดของ main */
.fi-main {
    padding-top: 0 !important;
}
.fi-main > div {
    padding-top: 0.25rem !important;
}
/* ลดช่องว่างหลัง topbar */
.fi-topbar {
    margin-bottom: 0 !important;
}
/* Header ชิดบน */
.fi-header.fi-header-has-breadcrumbs {
    padding-top: 0 !important;
    margin-top: 0 !important;
}
.fi-page-header-main-ctn {
    padding-top: 0 !important;
    margin-top: 0 !important;
}
/* Main container ไม่มี padding บน */
.fi-main-ctn {
    padding-top: 0 !important;
}
.fi-main > div:first-child {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

/* Login page - subheading (organization name) */
.fi-simple-header-subheading {
    font-size: 1.25rem !important;
    font-weight: 600 !important;
    color: rgb(245 158 11) !important;
}
