/* KP Unit Links — การ์ดสถิติคลิกได้ + ป๊อปอัปรายชื่อหน่วยงาน */
.kp-ul-card {
	cursor: pointer;
	position: relative;
	transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.kp-ul-card:hover,
.kp-ul-card:focus-visible {
	transform: translateY(-2px);
	box-shadow: 0 10px 26px rgba(11, 60, 93, .16);
	border-color: #0b63a8;
}
.kp-ul-card:focus-visible {
	outline: 3px solid rgba(11, 99, 168, .45);
	outline-offset: 2px;
}
.kp-ul-hint {
	position: absolute;
	right: 14px;
	bottom: 10px;
	font-size: 12px;
	line-height: 1;
	color: #0b63a8;
	opacity: .8;
	pointer-events: none;
	white-space: nowrap;
}
.kp-ul-card:hover .kp-ul-hint { opacity: 1; }

body.kp-ul-lock { overflow: hidden; }

.kp-ul-overlay {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 24px 16px;
	background: rgba(8, 27, 42, .55);
	backdrop-filter: blur(2px);
}
.kp-ul-overlay.is-open { display: flex; }

.kp-ul-modal {
	position: relative;
	background: #fff;
	border-radius: 16px;
	width: min(960px, 100%);
	max-height: min(84vh, 760px);
	display: flex;
	flex-direction: column;
	box-shadow: 0 24px 70px rgba(6, 30, 48, .35);
	overflow: hidden;
	animation: kp-ul-in .18s ease-out;
}
@keyframes kp-ul-in {
	from { opacity: 0; transform: translateY(10px) scale(.99); }
	to   { opacity: 1; transform: none; }
}

.kp-ul-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	padding: 18px 20px 12px;
	border-bottom: 1px solid #e6eef4;
	background: linear-gradient(180deg, #f7fbfe, #fff);
}
.kp-ul-titlewrap { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.kp-ul-head h3 {
	margin: 0;
	font-size: 19px;
	line-height: 1.3;
	color: #0b3c5d;
	font-weight: 700;
}
.kp-ul-count {
	font-size: 13px;
	color: #5b7a90;
	background: #eef6fc;
	border-radius: 999px;
	padding: 3px 10px;
}
.kp-ul-close {
	border: 0;
	background: #eef6fc;
	color: #0b3c5d;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	flex: 0 0 auto;
	transition: background .15s ease;
}
.kp-ul-close:hover { background: #d9ebf8; }

.kp-ul-tools { padding: 12px 20px 0; }
.kp-ul-search {
	width: 100%;
	box-sizing: border-box;
	border: 1px solid #cfdde8;
	border-radius: 10px;
	padding: 10px 14px;
	font-size: 14px;
	color: #123;
	background: #fbfdff;
}
.kp-ul-search:focus {
	outline: none;
	border-color: #0b63a8;
	box-shadow: 0 0 0 3px rgba(11, 99, 168, .14);
}

.kp-ul-modal::after {
	content: '';
	position: absolute;
	left: 0; right: 0; bottom: 0;
	height: 40px;
	background: linear-gradient(to top, #fff 10%, rgba(255, 255, 255, 0));
	pointer-events: none;
	border-radius: 0 0 16px 16px;
}

.kp-ul-body {
	padding: 12px 20px 26px;
	overflow: auto;
	overscroll-behavior: contain;
	scrollbar-width: thin;
	scrollbar-color: #b9d4e6 transparent;
}
.kp-ul-body::-webkit-scrollbar { width: 9px; }
.kp-ul-body::-webkit-scrollbar-track { background: transparent; }
.kp-ul-body::-webkit-scrollbar-thumb { background: #cfe2ef; border-radius: 99px; }
.kp-ul-body::-webkit-scrollbar-thumb:hover { background: #a9c9de; }
.kp-ul-list {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 8px 18px;
}
.kp-ul-group { display: contents; }
.kp-ul-gtitle {
	grid-column: 1 / -1;
	margin: 14px 0 2px;
	font-size: 13px;
	font-weight: 700;
	color: #0b63a8;
	letter-spacing: .01em;
	border-bottom: 1px dashed #dbe8f2;
	padding-bottom: 5px;
}
.kp-ul-group:first-of-type .kp-ul-gtitle { margin-top: 2px; }

.kp-ul-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 9px 12px;
	border-radius: 9px;
	font-size: 14px;
	line-height: 1.45;
	color: #16323f;
	background: #f7fafc;
	border: 1px solid #eaf1f6;
	text-decoration: none;
	min-width: 0;
}
.kp-ul-item.has-link { color: #0b4c78; }
.kp-ul-item.has-link:hover {
	background: #eaf4fc;
	border-color: #bcd9ee;
	text-decoration: none;
}
.kp-ul-name { min-width: 0; flex: 1 1 auto; }
.kp-ul-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.kp-ul-ico {
	width: 30px; height: 30px;
	display: inline-flex; align-items: center; justify-content: center;
	border-radius: 8px;
	background: #eef6fc;
	color: #0b63a8;
	border: 1px solid #dbe8f2;
	transition: background .15s ease, color .15s ease, border-color .15s ease, transform .15s ease;
}
.kp-ul-ico:hover { background: #dcecf9; border-color: #b7d4e9; transform: translateY(-1px); }
.kp-ul-ico.fb { background: #eaf1fd; color: #1877f2; border-color: #d6e3fb; }
.kp-ul-ico.fb:hover { background: #dbe8fd; border-color: #b9cff8; }
.kp-ul-item.has-link { background: #fbfdff; }

.kp-ul-empty {
	padding: 28px 4px;
	text-align: center;
	color: #6b8496;
	font-size: 14px;
}

@media (max-width: 720px) {
	.kp-ul-overlay { padding: 0; align-items: flex-end; }
	.kp-ul-modal {
		width: 100%;
		max-height: 92vh;
		border-radius: 16px 16px 0 0;
	}
	.kp-ul-list { grid-template-columns: minmax(0, 1fr); }
	.kp-ul-head h3 { font-size: 17px; }
	.kp-ul-hint { font-size: 11px; right: 10px; bottom: 8px; }
}
