/* =============================================
   FreeMode Design System - Responsive Styles
   Mobile & Tablet Breakpoints
   ============================================= */

/* ===== Mobile Responsiveness ===== */
/* 모바일 토글 버튼: 기본적으로 숨김 처리 */
.mobile-toggle-btn {
	display: none !important;
	visibility: hidden;
}

@media ( max-width: 1023px) {
	/* 모바일에서 가로 스크롤 방지 */
	html {
		-webkit-text-size-adjust: 100%;
		text-size-adjust: 100%;
	}

	body {
		overflow-x: hidden;
		max-width: 100vw;
	}
	html {
		overflow-x: hidden;
		max-width: 100vw;
	}

	/* 헤더를 fixed로 유지하면서 내부 요소의 absolute positioning 기준점으로 사용 */
	.dashboard-header {
		position: fixed;
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: env(safe-area-inset-top) 16px 0;
		z-index: calc(var(--k-z-header) + 1000);
		width: 100%;
		max-width: 100vw;
		left: 0;
		top: 0;
		box-sizing: border-box;
		background-color: var(--k-bg-white);
		height: calc(var(--header-height) + env(safe-area-inset-top));
		/* Ensure background is solid */
	}

	/* 모바일 본문은 상단 안전 영역을 포함한 고정 헤더 아래에서 시작한다. */
	.app-main {
		margin-top: calc(var(--header-height) + env(safe-area-inset-top));
	}

	.dashboard-header-brand {
		display: flex;
		align-items: center;
		gap: 8px;
		flex: 1;
		min-width: 0;
	}

	/* Sidebar: 기본 숨김 처리 */
	.app-main .sidebar-freemode {
		transform: translateX(-100%);
		transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
		z-index: var(--k-z-sidebar);
		position: fixed;
		top: calc(var(--header-height) + env(safe-area-inset-top));
		left: 0;
		height: calc(100dvh - var(--header-height) - env(safe-area-inset-top));
		width: 280px;
		max-width: 85vw;
	}

	/* Sidebar 활성화 시 표시 */
	.app-main .sidebar-freemode.active {
		transform: translateX(0);
	}

	/* 간트차트 메뉴: 모바일에서도 표시 (모바일 뷰 지원) */
	/* .sidebar-freemode .nav-item-freemode[data-nav="gantt"] - 이제 모바일에서도 표시됨 */

	/* 콘텐츠 영역: 사이드바 마진 제거 */
	.app-content {
		margin-left: 0 !important;
		padding: 16px !important;
	}

	/* 모바일 토글 버튼: 로고 왼쪽에서 사이드바 열기 동작을 제공한다. */
	.mobile-toggle-btn {
		display: flex !important;
		visibility: visible !important;
		align-items: center;
		justify-content: center;
		position: relative;
		width: 45px;
		height: 45px;
		background-color: var(--k-bg-white);
		border: var(--k-border-black);
		border-radius: 50%;
		cursor: pointer;
		z-index: 1002;
		font-size: 19px;
		color: var(--ref-ink);
		transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
		padding: 0;
		margin-right: 8px;
		flex-shrink: 0;
	}

	/* header-actions 내부 사용자 프로필 컨테이너 순서 조정 */
	.header-actions>div:not(.header-notification-container) {
		order: 2;
	}

	/* Font Awesome 아이콘 스타일 */
	.mobile-toggle-btn i {
		display: block;
		color: var(--ref-ink);
		font-size: 19px;
		line-height: 1;
	}

	/* 모바일 토글 버튼 열림 상태는 별도 클래스로 관리해 닫힐 때 즉시 기본색으로 복귀시킨다. */
	.mobile-toggle-btn.is-active,
	body.non-pc-dashboard .mobile-toggle-btn.is-active {
		background-color: var(--k-bg-blue);
	}

	.mobile-toggle-btn.is-active i,
	body.non-pc-dashboard .mobile-toggle-btn.is-active i {
		color: var(--ref-ink);
	}

	@media (hover: hover) and (pointer: fine) {
		.mobile-toggle-btn:hover {
			background-color: var(--k-bg-blue);
		}

		.mobile-toggle-btn:hover i {
			color: var(--ref-ink);
		}
	}

	.mobile-toggle-btn:active {
		transform: translateY(-1px);
		box-shadow: none;
	}
	.header-actions {
		order: 2;
		gap: 8px;
		display: flex;
		align-items: center;
		flex-shrink: 0;
	}
	/* 모바일 헤더에서는 알림 영역만 숨기고 프로필 화살표는 유지한다. */
	.header-notification-container {
		display: none !important;
	}

	/* 사용자 프로필: 모바일에서 표시 */
	#profileBtn {
		display: flex !important;
		flex-shrink: 0;
		justify-content: flex-end;
		width: auto !important;
		min-width: 64px;
		max-width: 80px;
		order: 2;
	}

	/* 모바일 헤더의 사용자 이름을 한 줄 말줄임으로 표시한다. */
	#profileBtn .header-profile-name {
		max-width: 80px;
		overflow: hidden;
		font-size: var(--fm-font-size-body) !important;
		line-height: 1.4;
		text-overflow: ellipsis;
		white-space: nowrap;
	}
	.dashboard-header-brand .sidebar-brand {
		display: flex !important;
		font-size: 18px !important;
		gap: 5px !important;
		line-height: 1;
		margin-right: auto;
		flex-shrink: 0;
		min-width: 0;
	}

	/* 모바일 헤더 로고: 로고 이미지와 브랜드 텍스트를 축소해 좁은 화면에서도 균형을 유지한다. */
	.dashboard-header-brand .sidebar-brand img {
		width: 20px !important;
		height: 22px !important;
	}

	/* 사이드바 오버레이 */
	.sidebar-overlay {
		display: none;
		position: fixed;
		top: calc(var(--header-height) + env(safe-area-inset-top));
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 200;
		background: color-mix(in srgb, var(--ref-ink) 60%, transparent);
		backdrop-filter: blur(1px);
		transition: opacity 0.3s ease;
	}
	.sidebar-overlay.active {
		display: block;
		animation: fadeInOpacity 0.3s ease;
	}
	@keyframes fadeInOpacity {
		from { opacity: 0; }
		to { opacity: 1; }
	}

	/* 모바일 모달 입력 시 가상 키보드 대응 */
	.modal-fullscreen-mobile {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		max-height: 100vh;
		max-height: 100dvh;
		border-radius: var(--fm-radius-medium);
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
	}
}

@media (max-width: 1023px) {
	.stat-label {
		font-size: 14px;
	}
}

/* ===== Task View Mobile Styles ===== */
.rotated {
	transform: rotate(-180deg);
}

/* Task View Mobile Responsive */
@media screen and (max-width: 1023px) {
	.table-container-freemode {
		display: none !important;
	}
	.home-header .header-actions {
		flex-wrap: wrap;
	}
	.home-header .header-actions .select-freemode {
		width: 100%;
		margin-bottom: 8px;
	}

	/* Mobile Modal Adjustments */
	.modal-container {
		width: 95% !important;
		max-width: 95% !important;
		margin: 10px !important;
		max-height: 90vh !important;
		overflow-y: auto !important;
	}
	.modal-body>div[style*="grid-template-columns"] {
		grid-template-columns: 1fr !important;
		gap: 13px !important;
	}
	.modal-body label {
		margin-bottom: 5px !important;
	}
	.modal-footer {
		flex-direction: column !important;
		gap: 8px !important;
	}
	.modal-footer .btn-freemode {
		width: 100% !important;
	}
}

/* ===== Calendar Mobile Styles ===== */
.calendar-grid-mobile {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 8px;
	padding: 0 20px 20px 20px;
	background: var(--k-bg-white);
	margin-bottom: 20px;
	border: 1px solid var(--k-color-gray-ddd);
	min-height: 300px;
	border-radius: var(--k-radius-sm);
	overflow: hidden;
}

.calendar-day-name-mobile {
	text-align: center;
	font-weight: 700;
	font-size: 14px;
	color: var(--k-text-gray);
	padding: 8px 0;
}

.calendar-day-mobile {
	aspect-ratio: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 25px;
	font-weight: 600;
	cursor: pointer;
	transition: var(--k-transition-fast);
	font-size: 14px;
}

.calendar-day-mobile:hover:not(.selected) {
	background-color: var(--k-bg-gray-light);
}

.calendar-day-mobile.today {
	background-color: var(--k-bg-blue);
	color: var(--k-bg-white);
	font-weight: 700;
}

.calendar-day-mobile.selected {
	background-color: var(--k-status-warning-bg);
	color: var(--ref-accent-yellow);
	font-weight: 700;
	border: 2px solid var(--ref-accent-yellow);
}

.calendar-day-mobile {
	position: relative;
}

.calendar-day-mobile .day-number {
	display: block;
}

.calendar-day-mobile.has-event .event-dot {
	position: absolute;
	bottom: 4px;
	left: 50%;
	transform: translateX(-50%);
	width: 4px;
	height: 4px;
	background-color: var(--k-bg-blue);
	border-radius: 50%;
}

.calendar-day-mobile.selected .event-dot {
	background-color: var(--ref-ink);
}

.calendar-day-mobile.today .event-dot {
	background-color: var(--k-bg-white);
}

.selected-date-mobile {
	padding: 0 20px;
	margin-bottom: 10px;
	font-weight: 700;
	color: var(--k-text-gray);
	font-size: 15px;
}

.calendar-events-mobile {
	padding: 0 0px 80px 0px;
}

.agenda-event-mobile {
	background: var(--k-bg-white);
	border-radius: var(--k-radius-xl);
	padding: 16px;
	margin-bottom: 12px;
	border-left: 5px solid var(--k-bg-blue);
	box-shadow: 2px 2px 0px var(--k-overlay-dark-10);
	display: flex;
	align-items: flex-start;
	gap: 12px;
	cursor: pointer;
	transition: var(--k-transition-fast);
}

.agenda-event-mobile:active {
	transform: translateY(1px);
	box-shadow: 1px 1px 0px var(--k-overlay-dark-10);
}

.agenda-event-mobile.is-holiday-event-mobile {
	background: var(--k-status-danger-bg);
	cursor: default;
}

.agenda-event-mobile.is-holiday-event-mobile:active {
	transform: none;
	box-shadow: 2px 2px 0px var(--k-overlay-dark-10);
}

.event-time-mobile {
	width: 60px;
	font-weight: 700;
	font-size: 14px;
	color: var(--ref-ink);
	flex-shrink: 0;
}

.event-content-mobile {
	flex: 1;
	min-width: 0;
}

.event-title-mobile {
	font-weight: 600;
	margin-bottom: 4px;
	color: var(--ref-ink);
	font-size: 16px;
	line-height: 1.4;
}

.event-desc-mobile {
	font-size: 13px;
	color: var(--k-text-gray);
	line-height: 1.5;
	margin-top: 4px;
}

/* Calendar Mobile Responsive */
@media screen and (max-width: 1023px) {
	.toastui-calendar-day-name__date {
		font-size: 18px !important;
	}
	.cal-content #calendar { height: auto; min-height: 400px; }
	.calendar-desktop {
		display: none;
	}
	.calendar-mobile {
		display: block;
		min-height: 300px;
	}

	/* 모바일에서 주간/일간 뷰일 때 데스크톱 캘린더 표시 */
	.calendar-desktop.show-on-mobile {
		display: block !important;
		min-height: 300px;
	}
	.calendar-mobile.hide-on-mobile {
		display: none !important;
	}
	.calendar-fab-mobile {
		display: flex !important;
	}

	/* Mobile Modal Adjustments for Calendar - .modal-container 기본 스타일은
	   Task View 미디어 쿼리에서 이미 정의됨 (중복 제거) */

	/* 모바일 전체화면 모달 - 카드 형식 */
	/* 전체화면 모달이 있을 때 오버레이 상단 정렬 */
	.modal-overlay:has(.modal-fullscreen-mobile) {
		align-items: flex-start !important;
		padding-top: 2.5vh !important;
	}
	/* .modal-body, .modal-footer 공통 모바일 스타일은
	   Task View 미디어 쿼리에서 이미 정의됨 (중복 제거) */
}

@media screen and (min-width: 1024px) {
	/* PC에서는 전체화면 모바일 모달의 크기를 축소해 미리보기/메일 모달 가독성을 높인다. */
	.modal-overlay .modal-container.modal-fullscreen-mobile,
	.modal-overlay .modal-freemode.modal-fullscreen-mobile,
	.modal-overlay .modal-container-tab.modal-fullscreen-mobile {
		width: 75%;
		max-width: 75%;
		max-height: 90vh;
	}

	/* 견적서 메일 발송 모달은 PC에서 소형 폭을 유지한다. */
	#estimateMailModal .modal-container.modal-small.modal-fullscreen-mobile {
		width: 400px !important;
		max-width: 400px !important;
	}

	.calendar-mobile {
		display: none !important;
	}
	.calendar-desktop {
		display: block !important;
	}
	.calendar-fab-mobile {
		display: none !important;
	}

}

/* ===== Project Detail View Mobile Styles ===== */
@media screen and (max-width: 1023px) {
	/* 컨테이너 패딩 조정 */
	.workhub-home-container {
		padding: 6px;
	}

	/* 헤더 영역 모바일 최적화 */
	.workhub-home-container .home-header {
		position: sticky;
		top: 0;
		background: var(--ref-bg-base);
		z-index: 100;
		padding: 12px 0;
		margin-bottom: 16px;
		border-bottom: var(--k-border-light);
	}
	.workhub-home-container .home-header .header-content {
		flex-direction: column;
		align-items: flex-start;
		gap: 12px;
	}
	.workhub-home-container .home-header .page-title {
		font-size: 19px !important;
		line-height: 1.3;
		word-break: keep-all;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
		max-width: 100%;
	}
	.workhub-home-container .home-header .header-actions {
		width: 100%;
		display: flex;
		gap: 8px;
		justify-content: flex-end;
	}

	/* 모바일에서 공유하기 버튼 숨기기 */
	.workhub-home-container .home-header .header-actions .btn-freemode:first-child
		{
		display: none !important;
	}
	.workhub-home-container .home-header .header-actions .btn-freemode {
		padding: 8px 12px;
		font-size: 14px;
		min-height: 36px;
	}
	.workhub-home-container .home-header .header-actions .btn-freemode .icon
		{
		margin-right: 4px;
	}

	/* 탭 네비게이션 - 모바일 공통 */
	.workhub-home-container .tabs-freemode {
		display: flex;
		width: 100%;
		padding: 3px;
	}
	.workhub-home-container .tab-link-freemode {
		flex: 1;
		padding: 10px 0;
		font-size: 14px;
		white-space: nowrap;
		min-width: 0;
	}
	.workhub-home-container .project-tabs {
		margin-bottom: 0;
	}

	/* 모달 모바일 최적화 */
	.modal-overlay .modal-body .form-group {
		margin-bottom: 16px;
	}
	.modal-overlay .modal-body .form-row {
		flex-direction: column;
		gap: 16px;
	}
	.modal-overlay .modal-footer {
		flex-direction: column;
		gap: 8px;
		padding: var(--fm-modal-body-footer-gap) 16px 16px;
	}
	.modal-overlay .modal-footer .btn-freemode {
		width: 100%;
		margin: 0;
		height: 44px;
	}
	.modal-overlay .modal-footer.space-between {
		flex-direction: column;
	}
	/* 업무 상세 모달 모바일 */
	.modal-overlay #taskDetailModal .modal-container-tab {
		width: 95% !important;
		max-width: 95% !important;
	}
	/* 캘린더 주간 헤더 모바일 폰트 크기 조정 */
	.workhub-home-container .toastui-calendar-day-name-item,
		.workhub-home-container [data-testid="grid-header-week"] .toastui-calendar-day-name-item,
		.workhub-home-container .day-names.week .toastui-calendar-day-name-item
		{
		font-size: 12px !important;
	}
}

/* 데스크톱에서 모바일 전용 요소 숨김 */
@media screen and (min-width: 1024px) {
	.workhub-home-container #settlementCardBody {
		display: none !important;
	}
}

/* ===== Setting View Mobile Styles ===== */
@media screen and (max-width: 1023px) {
	/* Container Padding */
	.container-freemode[style*="max-width: 1200px"] {
		padding: 16px !important;
		max-width: 100% !important;
	}

	/* Header Adjustments */
	.project-header[style*="margin-bottom: 32px"] {
		margin-bottom: 24px !important;
		padding: 0 8px;
	}
	.project-header h1[style*="font-size: 40px"] {
		font-size: 29px !important;
		margin-bottom: 12px !important;
	}

	/* 모바일 설정 탭 메뉴를 가로 스크롤 형태로 표시한다. */
	.setting-mobile-tabs {
		display: flex;
		gap: 8px;
		margin-bottom: 24px;
		padding: 0 8px;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
	}
	.setting-mobile-tabs::-webkit-scrollbar {
		display: none;
	}
	.setting-mobile-tab {
		flex: 1;
		min-width: 80px;
		display: flex;
		flex-direction: column;
		align-items: center;
		gap: 4px;
		padding: 12px 8px;
		background: var(--k-bg-white);
		border: var(--k-border-black);
		border-radius: var(--k-radius-md);
		cursor: pointer;
		transition: var(--k-transition-fast);
		font-size: 12px;
		font-weight: 600;
		color: var(--k-text-gray);
		white-space: nowrap;
	}
	.setting-mobile-tab i {
		font-size: 20px;
		margin-bottom: 4px;
	}
	/* 활성화된 모바일 설정 탭에 현재 메인 컬러를 적용한다. */
	.setting-mobile-tab.active {
		background: var(--fm-color-primary-soft);
		color: var(--fm-color-primary);
		font-weight: 700;
		box-shadow: var(--k-shadow-soft);
	}
	.setting-mobile-tab:hover:not(.active) {
		background: var(--k-bg-gray-light);
		transform: translate(1px, 1px);
	}

	/* Hide Desktop Sidebar on Mobile */
	.setting-sidebar-freemode {
		display: none !important;
	}

	/* Layout Adjustments */
	.setting-layout-freemode {
		flex-direction: column;
		min-height: auto;
		border-radius: var(--k-radius-md);
	}

	/* Content Area */
	.setting-content-freemode {
		padding: 24px !important;
		width: 100%;
	}

	/* Section Title */
	.setting-title-freemode {
		font-size: 24px !important;
		margin-bottom: 16px !important;
		margin-top: 0px;
	}
	.setting-desc-freemode {
		font-size: 14px !important;
		margin-bottom: 24px !important;
	}

	/* Card Padding */
	.card-freemode[style*="padding: 32px"] {
		padding: 24px !important;
	}

	/* Form Grid - 2열을 1열로 변경 */
	.setting-form-grid {
		grid-template-columns: 1fr !important;
		gap: 8px !important;
		margin-bottom: 16px !important;
	}

	/* Form Group */
	.form-group-freemode {
		margin-bottom: 16px;
	}

	/* Label */
	.label-freemode {
		font-size: 14px !important;
		margin-bottom: 8px !important;
	}

	/* Input */
	.input-freemode {
		font-size: 15px !important;
		padding: 12px !important;
	}

	/* Address Input Row */
	.setting-content-freemode .form-group-freemode>div[style*="display: flex"]
		{
		flex-direction: column !important;
		gap: 8px !important;
	}
	.setting-content-freemode .form-group-freemode>div[style*="display: flex"]>input[style*="width: 150px"],
		.setting-content-freemode .form-group-freemode>div[style*="display: flex"]>input[id="ibxCompanyZipCode"]
		{
		width: 100% !important;
	}
	.setting-content-freemode .form-group-freemode>div[style*="display: flex"]>button
		{
		width: 100%;
	}

	/* Button Adjustments */
	.btn-freemode[style*="padding: 16px 32px"] {
		padding: 14px 24px !important;
		width: 100%;
		justify-content: center;
	}

	/* Row Layout Cards (Integrations, Notifications, Security) */
	.card-freemode.row-layout {
		flex-direction: column !important;
		gap: 16px !important;
		padding: 24px !important;
	}
	.row-content {
		width: 100% !important;
	}
	.row-action {
		width: 100% !important;
		display: flex;
		justify-content: flex-start;
		align-items: center;
		gap: 8px;
		flex-wrap: wrap;
	}
	.row-action .badge-core {
		margin-right: 8px;
	}
	.row-action .btn-freemode {
		flex: 1;
		min-width: auto;
	}

	/* Contact Icon Box */
	.contact-icon-box {
		width: 50px !important;
		height: 50px !important;
		font-size: 24px !important;
	}

	/* Modal Adjustments */
	.modal-container.modal-small[style*="width: 400px"] {
		width: 95% !important;
		max-width: 95% !important;
		margin: 10px !important;
	}
	/* .modal-body padding은 Task View 미디어 쿼리에서 이미 정의됨 (중복 제거) */
	.modal-body .form-group-freemode {
		margin-bottom: 16px;
	}

	/* Divider */
	div[style*="height: 1px"][style*="background-color: var(--k-border-light-color)"] {
		margin: 24px 0 !important;
	}
}

/* Desktop: Left Sidebar Layout for Setting View */
@media screen and (min-width: 1024px) {
	/* 설정 페이지는 앱 컨테이너 최대 폭 제한을 해제해 좌측 사이드바와 본문이 벌어지지 않게 한다. */
	.app-container.setting-view-app-container {
		width: 100%;
		max-width: 100%;
		margin: 0;
	}

	/* 설정 페이지 콘텐츠 영역의 좌측 여백을 제거해 메인 사이드바와 바로 맞닿게 한다. */
	.app-content.setting-view-app-content,
	.app-content:has(.setting-layout-freemode) {
		padding: 0;
		overflow: hidden;
	}

	/* 설정 페이지 컨테이너를 전체 폭으로 확장해 해상도가 커져도 좌측 정렬을 유지한다. */
	.app-content.setting-view-app-content > .container-freemode.setting-view-page,
	.app-content:has(.setting-layout-freemode) .container-freemode.setting-view-page {
		flex: 1;
		display: flex;
		flex-direction: column;
		height: 100%;
		min-height: 0;
		width: 100% !important;
		max-width: 100% !important;
		margin: 0 !important;
		align-self: stretch;
		padding: 0 !important;
	}

	/* 데스크톱 헤더 숨김 (사이드바에 제목 표시) */
	.setting-page-header {
		display: none !important;
	}

	/* 모바일 탭 숨김 */
	.setting-mobile-tabs {
		display: none !important;
	}

	/* 사이드바 표시 */
	.setting-sidebar-freemode {
		display: block !important;
		width: 230px;
		min-width: 230px;
		height: 100%;
		background-color: var(--k-bg-white);
		padding: 24px 0;
		overflow-y: auto;
	}

	/* 사이드바 제목 - 데스크톱에서 표시 (style.css에서 display:none 기본값) */
	.setting-sidebar-title {
		display: block;
	}

	/* 레이아웃 - 가로 방향, 남은 높이 전부 차지 */
	.setting-layout-freemode {
		flex: 1;
		flex-direction: row;
		height: 100%;
		border-radius: 0;
		box-shadow: none;
		border: none;
		min-height: 0;
		background-color: var(--k-bg-white);
		overflow: hidden;
	}

	/* 메뉴 아이템 스타일 */
	.setting-menu-item-freemode {
		padding: 8px 16px;
		margin: 0 12px;
		border-radius: 8px;
		font-size: 15px;
		font-weight: 400;
		color: var(--ref-gray-700);
	}
	.setting-menu-item-freemode:hover {
		background-color: var(--k-overlay-dark-03);
		color: var(--ref-ink);
	}
	.setting-menu-item-freemode.active {
		background-color: var(--k-status-danger-bg);
		color: var(--ref-accent-orange);
		font-weight: 700;
		border: none;
		border-radius: 8px;
		margin: 0 12px;
		padding: 8px 16px;
	}

	/* 콘텐츠 영역 - 카드와 구분되는 배경 */
	.setting-content-freemode {
		flex: 1;
		min-width: 0;
		min-height: 0;
		padding: 24px;
		background-color: var(--ref-bg-base);
		overflow-y: auto;
	}


	/* 카드 스타일 - 콘텐츠 배경과 분리 */
	.setting-content-freemode > .setting-section-freemode > .card-freemode {
		border-radius: var(--k-radius-md);
		box-shadow: 0 1px 3px var(--k-overlay-dark-04);
		border: var(--k-border-light);
		background-color: var(--k-bg-white);
		cursor: default;
	}
	.setting-content-freemode .card-freemode:hover {
		box-shadow: var(--k-shadow-hover);
		transform: none;
	}
	.setting-content-freemode .card-freemode.row-layout {
		border-radius: var(--k-radius-md);
		box-shadow: var(--k-shadow-box);
		border: none;
	}
	.setting-content-freemode .card-freemode.row-layout:hover {
		box-shadow: var(--k-shadow-hover);
	}
}

/* Color Option Styles */
.color-option {
	width: 30px;
	height: 30px;
	border-radius: 50%;
	cursor: pointer;
	border: 2px solid transparent;
	transition: var(--k-transition-fast);
	position: relative;
}

.color-option:hover {
	transform: scale(1.1);
}

.color-option.active {
	border: var(--k-border-black-hard) !important;
	box-shadow: 0 0 0 2px var(--k-overlay-charcoal-10);
}


#estimateMailModal .modal-footer .footer-left {
	display: flex;
	align-items: center;
}

#estimateMailModal .modal-footer .footer-right {
	display: flex;
	gap: 8px;
	align-items: center;
}

.color-manage-link {
	background: none;
	border: none;
	color: var(--k-text-subtle);
	font-size: 14px;
	cursor: pointer;
	padding: 4px 0px;
	display: flex;
	align-items: center;
	gap: 4px;
	transition: color 0.2s ease;
	margin-top: 12px;
}

.color-manage-link:hover {
	color: var(--ref-ink);
}

.color-manage-link .icon {
	font-size: 14px;
}

#taskCreateModal .modal-container-tab {
	border: none !important;
	box-shadow: var(--k-shadow-modal) !important;
	background: var(--k-bg-white);
	border-radius: var(--fm-radius-medium);
}

#taskCreateModal .modal-header {
	padding-bottom: 8px;
	margin-bottom: 16px;
	border-bottom: var(--k-border-thin);
}

/* 업무 생성 모달 제목의 글자 위계를 공통 기준과 맞춘다. */
#taskCreateModal .modal-title {
	font-size: var(--fm-font-size-heading-small);
	font-weight: 600;
	color: var(--ref-ink);
}

#taskCreateModal .input-freemode {
	border: var(--k-border-thin) !important;
	border-radius: var(--k-radius-md) !important;
	padding: 10px 16px;
	font-size: 14px;
	transition: border-color 0.2s ease;
}

#taskCreateModal .input-freemode:focus {
	outline: none;
	border-color: var(--ref-ink) !important;
}

#taskCreateModal .modal-footer {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	padding-top: var(--fm-modal-body-footer-gap);
	margin-top: 0;
	border-top: var(--k-border-thin);
}

.modal-overlay .custom-select-trigger {
	border: var(--k-border-thin) !important;
	border-radius: var(--k-radius-md) !important;
}

.modal-overlay .custom-select-wrapper.open .custom-select-trigger {
	border-color: var(--ref-ink) !important;
	box-shadow: none !important;
}

/* colorPaletteModal input 스타일은 공통 모달 스타일 사용 */

#eventModal .modal-container-tab {
	border: none !important;
	box-shadow: var(--k-shadow-modal) !important;
	background: var(--k-bg-white);
	border-radius: var(--fm-radius-medium);
}

#eventModal .modal-header {
	padding-bottom: 8px;
	margin-bottom: 16px;
}

/* Color Palette Modal - 컴포넌트 스타일 (모달 구조는 공통 스타일 사용) */
#colorPaletteModal .color-add-form {
	border-radius: var(--k-radius-md);
	margin-bottom: 16px;
}

#colorPaletteModal .color-palette-item {
	background: var(--k-bg-white);
	border: 1px solid var(--k-border-color-light);
	border-radius: var(--k-radius-md);
	margin-bottom: 8px;
	transition: var(--k-transition-fast);
}

#colorPaletteModal .color-palette-item:hover {
	border-color: var(--k-color-gray-e5);
	box-shadow: 0 2px 4px var(--k-overlay-dark-04);
}

#colorPaletteModal .palette-delete {
	color: var(--k-color-slate-400);
	cursor: pointer;
	padding: 4px 8px;
	font-size: 14px;
	transition: color 0.2s ease;
}

#colorPaletteModal .palette-delete:hover {
	color: var(--ref-accent-orange-soft);
}

/* Color Palette Modal - Mobile */
@media ( max-width: 1023px) {
	#colorPaletteModal .color-add-form {
		flex-wrap: wrap;
	}
	#colorPaletteModal .color-add-form input[type="color"] {
		width: 50px !important;
	}
	#colorPaletteModal .color-add-form input[type="text"] {
		flex: 1;
		min-width: 120px;
	}
	#colorPaletteModal .color-palette-list {
		max-height: 40vh !important;
	}
}

/* Task Detail Modal - projectCreateModal 디자인 적용 */
#taskDetailModal.modal-overlay {
	background: color-mix(in srgb, var(--ref-ink) 60%, transparent);
	backdrop-filter: blur(1px);
}

#taskDetailModal .modal-container-tab {
	border: none !important;
	box-shadow: var(--k-shadow-modal) !important;
	background: var(--k-bg-white);
	border-radius: var(--fm-radius-medium);
}

#taskDetailModal .modal-header {
	padding-bottom: 8px;
	margin-bottom: 16px;
}

.info-card-content {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.info-row {
	display: flex;
	align-items: center;
	padding: 8px 0;
}

.info-label {
	font-weight: 600;
	color: var(--k-text-gray);
	font-size: 15px;
}

.info-value {
	font-weight: 400;
	color: var(--ref-ink);
	font-size: 14px;
	text-align: right;
}

.info-text {
	color: var(--ref-ink);
	font-size: 15px;
	line-height: 1.6;
	margin: 0;
	white-space: pre-wrap;
}

/* 브레드크럼 네비게이션 바 스타일 */
.breadcrumb-nav {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	color: var(--ref-gray-700);
	margin-bottom: 8px;
}

.breadcrumb-link {
	color: var(--ref-gray-700);
	text-decoration: none;
	transition: color 0.2s;
}

/* 뒤로가기 브레드크럼 아이콘 스타일 */
.breadcrumb-link-back {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

.breadcrumb-link-back::before {
	content: "<";
	font-size: 16px;
	font-weight: 600;
	line-height: 1;
}

.breadcrumb-link:hover {
	color: var(--k-text-gray, var(--k-color-red-alert));
	text-decoration: underline;
}

.breadcrumb-text {
	color: var(--ref-gray-700);
}

.breadcrumb-text-last {
	color: var(--ref-ink, var(--k-text-body));
	font-weight: 600;
}

.breadcrumb-separator {
	color: var(--ref-gray-700);
	margin: 0 4px;
}

/* ===== Custom Alert & Confirm Styles ===== */
.custom-alert-overlay {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	padding: var(--fm-space-4);
	box-sizing: border-box;
	background: var(--k-overlay-dark-50);
	display: flex;
	justify-content: center;
	align-items: center;
	z-index: var(--k-z-critical);
}

/* 커스텀 알림 모달의 숨김 상태를 보장한다. */
.custom-alert-overlay[hidden] {
	display: none !important;
}

.custom-alert-container {
	width: 412px;
	max-width: calc(100vw - 32px);
	max-height: calc(100dvh - 32px);
	padding: var(--fm-space-9) var(--fm-space-6) var(--fm-space-6);
	box-sizing: border-box;
	position: relative;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	align-items: center;
	background: var(--fm-color-surface);
	border: 1px solid var(--fm-color-border);
	border-radius: var(--fm-radius-medium);
	box-shadow: var(--fm-shadow-modal);
	animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.custom-alert-header {
	width: 100%;
	padding: 0;
	margin: var(--fm-space-6) 0 0;
	border: 0;
}

.custom-alert-title {
	margin: 0;
	color: var(--fm-color-text-primary);
	font-family: var(--fm-font-family);
	font-size: var(--fm-font-size-heading);
	font-weight: 600;
	line-height: 1.4;
	letter-spacing: -0.03em;
	text-align: center;
}

.custom-alert-body {
	width: 100%;
	min-height: 50px;
	margin-top: var(--fm-space-8);
	padding: 0;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
}

.custom-alert-icon {
	width: var(--fm-control-height-medium);
	height: var(--fm-control-height-medium);
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: var(--fm-radius-pill);
	flex-shrink: 0;
}

.custom-alert-icon svg {
	width: var(--fm-space-6);
	height: var(--fm-space-6);
}

/* Alert 타입별 아이콘 색상 */
.custom-alert-icon.alert-info,
.custom-alert-icon.alert-success {
	color: var(--fm-color-surface);
	background: var(--fm-color-primary);
}

.custom-alert-icon.alert-warning {
	color: var(--k-status-warning-text);
	background: var(--k-status-warning-bg);
}

.custom-alert-icon.alert-error {
	color: var(--fm-color-surface);
	background: var(--fm-color-danger);
}

.custom-alert-icon.alert-question {
	color: var(--fm-color-surface);
	background: var(--fm-color-primary);
}

.custom-alert-message {
	margin: 0;
	color: var(--fm-color-text-secondary);
	font-family: var(--fm-font-family);
	font-size: var(--fm-font-size-body-large);
	font-weight: 500;
	line-height: 1.55;
	word-break: break-word;
	white-space: pre-line;
}

.custom-alert-footer {
	width: 100%;
	margin-top: var(--fm-modal-body-footer-gap);
	padding: 0;
	display: grid;
	gap: var(--fm-space-3);
	border: 0;
}

.custom-alert-footer.single-button {
	grid-template-columns: 1fr;
}

.custom-alert-footer.two-buttons {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.custom-alert-footer .btn-freemode {
	width: 100%;
	min-width: 0;
	height: var(--fm-control-height-large);
	min-height: var(--fm-control-height-large);
	padding: 0 var(--fm-space-4);
	font-family: var(--fm-font-family);
	font-size: var(--fm-font-size-body-large);
	font-weight: 500;
	border-radius: var(--fm-radius-medium);
	box-shadow: none;
}

.custom-alert-footer .btn-freemode.btn-main.is-primary {
	color: var(--fm-color-surface);
	background: var(--fm-color-primary);
	border: 1px solid var(--fm-color-primary);
}

.custom-alert-footer .btn-freemode.btn-main.is-primary:hover {
	color: var(--fm-color-surface);
	background: var(--fm-color-primary);
	border-color: var(--fm-color-primary);
	box-shadow: none;
	opacity: 0.94;
}

.custom-alert-footer .btn-freemode.btn-sub.is-line {
	color: var(--fm-color-text-primary);
	background: var(--fm-color-surface);
	border: 1px solid var(--fm-color-border-strong);
}

.custom-alert-footer .btn-freemode.btn-sub.is-line:hover {
	color: var(--fm-color-text-primary);
	background: var(--fm-color-canvas);
	border-color: var(--fm-color-border-strong);
	box-shadow: none;
}

/* 모바일 반응형 */
@media screen and (max-width: 1023px) {
	.custom-alert-container {
		width: min(412px, calc(100vw - 24px));
		max-width: calc(100vw - 24px);
		max-height: calc(100dvh - 24px);
		padding: var(--fm-space-8) var(--fm-space-5) var(--fm-space-5);
	}

	.custom-alert-header {
		padding: 0;
		margin-top: var(--fm-space-5);
	}

	.custom-alert-title {
		font-size: var(--fm-font-size-heading-small);
	}

	.custom-alert-body {
		margin-top: var(--fm-space-6);
		padding: 0;
	}

	.custom-alert-icon {
		width: var(--fm-control-height-medium);
		height: var(--fm-control-height-medium);
	}

	.custom-alert-icon svg {
		width: var(--fm-space-6);
		height: var(--fm-space-6);
	}

	.custom-alert-message {
		font-size: var(--fm-font-size-body);
	}

	.custom-alert-footer .btn-freemode {
		width: 100%;
	}
}

/* 기존 소형 삭제 버튼 클래스의 공통 규격을 유지한다. */
.schedule-btn-delete {
	width: 28px;
	height: 28px;
	background: none;
	border: none;
	font-size: 14px;
	cursor: pointer;
	padding: 4px;
	transition: var(--k-transition-fast);
	border-radius: var(--k-radius-sm);
}

.schedule-btn-delete { color: var(--ref-accent-orange); }
.schedule-btn-delete:hover { color: var(--ref-accent-orange); transform: scale(1.1); }

/* ========================================
   Dropdown Modal (PC에서 버튼 아래 배치)
   ======================================== */
@media ( min-width: 1024px) {
	@keyframes dropdownFadeIn {
		from { opacity: 0; transform: translateY(-8px); }
		to { opacity: 1; transform: translateY(0); }
	}

}

/* ======================================
   프로젝트 상태 드롭다운 스타일
   ====================================== */
.project-status-dropdown {
	position: relative;
	display: inline-block;
}

.status-dropdown-trigger {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px;
	border-radius: 20px;
	border: 1px solid var(--k-border-color);
	background: var(--k-bg-white);
	cursor: pointer;
	font-size: 14px;
	font-weight: 500;
	transition: all 0.2s;
}

.status-dropdown-trigger:hover {
	background: var(--k-bg-hover);
	box-shadow: 0 2px 4px var(--k-overlay-dark-10);
}

.status-dropdown-menu {
	position: absolute;
	top: 100%;
	left: 0;
	margin-top: 4px;
	background: var(--k-bg-white);
	border: 1px solid var(--k-border-color);
	border-radius: var(--k-radius-md);
	box-shadow: 0 4px 12px var(--k-overlay-dark-10);
	z-index: 100;
	min-width: 140px;
	overflow: hidden;
	animation: dropdownFadeIn 0.15s ease-out;
}

.status-option {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 14px;
	cursor: pointer;
	transition: background 0.2s;
	font-size: 14px;
}

.status-option:hover {
	background: var(--k-border-color-light);
}

.status-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	display: inline-block;
	flex-shrink: 0;
}

.status-dropdown-trigger .fa-chevron-down {
	font-size: 10px;
	color: var(--k-text-subtle);
}

/* ========================================
   Gantt Chart Mobile Styles
   ======================================== */

/* 간트차트 메뉴 모바일에서 표시 (기존 숨김 해제) */
@media ( max-width: 1023px) {
	.sidebar-freemode .nav-item-freemode[data-nav="gantt"] {
		display: flex !important;
	}

	/* 모바일 전용 요소 표시 */
	.gantt-mobile-only {
		display: block !important;
	}

	/* 데스크톱 전용 요소 숨김 */
	.gantt-desktop-only {
		display: none !important;
	}

	/* 모바일 컨테이너 */
	.gantt-mobile-container {
		padding-bottom: 80px;
		min-height: calc(100vh - 200px);
	}

	/* 정렬 바 */
	.gantt-mobile-sort-bar {
		display: flex;
		align-items: center;
		gap: 8px;
		padding: 12px 0;
		margin-bottom: 8px;
		border-bottom: 1px solid var(--k-color-gray-e5);
	}
	.gantt-mobile-sort-label {
		font-size: 14px;
		color: var(--k-text-gray);
		font-weight: 500;
	}
	/* 모바일 리스트 */
	.gantt-mobile-list {
		display: flex;
		flex-direction: column;
		gap: 12px;
	}

	/* 모바일 카드 */
	.gantt-mobile-card {
		display: flex;
		background: var(--k-bg-white);
		border: 1px solid var(--k-color-gray-e5);
		border-radius: var(--k-radius-xl);
		overflow: hidden;
		box-shadow: 0 2px 4px var(--k-overlay-dark-04);
		cursor: pointer;
		transition: var(--k-transition-fast);
	}
	.gantt-mobile-card:hover, .gantt-mobile-card:active {
		border-color: var(--k-color-gray-d1);
		box-shadow: 0 4px 8px var(--k-overlay-dark-10);
		transform: translateY(-1px);
	}

	/* 색상 바 */
	.gantt-mobile-card-color {
		width: 6px;
		flex-shrink: 0;
	}

	/* 카드 콘텐츠 */
	.gantt-mobile-card-content {
		flex: 1;
		padding: 16px;
		display: flex;
		flex-direction: column;
		gap: 8px;
	}

	/* 카드 헤더 */
	.gantt-mobile-card-header {
		display: flex;
		justify-content: space-between;
		align-items: flex-start;
		gap: 8px;
	}
	.gantt-mobile-card-title {
		font-size: 16px;
		font-weight: 600;
		color: var(--ref-ink);
		line-height: 1.3;
		word-break: break-word;
	}

	/* D-Day 뱃지 */
	.gantt-mobile-dday {
		flex-shrink: 0;
		padding: 3px 8px;
		border-radius: var(--k-radius-sm);
		font-size: 12px;
		font-weight: 600;
	}
	.gantt-mobile-dday.future {
		background: var(--k-bg-info-soft-200);
		color: var(--k-color-blue-700);
	}
	.gantt-mobile-dday.today {
		background: var(--k-status-warning-bg);
		color: var(--k-color-amber-700);
	}
	.gantt-mobile-dday.past {
		background: var(--k-bg-pink);
		color: var(--k-color-red-600);
	}

	/* 날짜 정보 */
	.gantt-mobile-card-date {
		font-size: 14px;
		color: var(--k-text-gray);
		display: flex;
		align-items: center;
		gap: 5px;
	}
	.gantt-mobile-card-date i {
		font-size: 13px;
	}
	.gantt-mobile-card-date .duration {
		color: var(--k-color-gray-9c);
	}

	/* 진행률 바 */
	.gantt-mobile-card-progress {
		display: flex;
		align-items: center;
		gap: 8px;
		margin-top: 4px;
	}
	.gantt-mobile-progress-bar {
		flex: 1;
		height: 6px;
		background: var(--k-bg-gray-light);
		border-radius: 3px;
		overflow: hidden;
	}
	.gantt-mobile-progress-fill {
		height: 100%;
		border-radius: 3px;
		transition: width 0.3s ease;
	}
	.gantt-mobile-progress-text {
		font-size: 12px;
		color: var(--k-color-gray-9c);
		min-width: 32px;
		text-align: right;
	}

	/* Empty State */
	.gantt-mobile-empty {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		padding: 48px 16px;
		text-align: center;
	}

	/* FAB 버튼 */
	.gantt-mobile-fab {
		position: fixed;
		bottom: 80px;
		right: 20px;
		width: 56px;
		height: 56px;
		border-radius: 50%;
		background: var(--ref-accent-yellow, var(--ref-accent-yellow-blue));
		color: var(--k-bg-white);
		border: none;
		box-shadow: 0 4px 12px var(--k-overlay-blue-30);
		display: flex;
		align-items: center;
		justify-content: center;
		cursor: pointer;
		z-index: 100;
		transition: var(--k-transition-fast);
	}
	.gantt-mobile-fab:hover, .gantt-mobile-fab:active {
		transform: scale(1.05);
		box-shadow: 0 6px 16px var(--k-overlay-dark-20);
	}
	.gantt-mobile-fab i {
		font-size: 20px;
		color: var(--k-text-black);
	}

	/* 모바일 헤더 버튼 스타일 */
	.gantt-mobile-only.project-header .btn-freemode {
		width: 40px;
		height: 40px;
		padding: 0;
		display: flex;
		align-items: center;
		justify-content: center;
	}
	.gantt-mobile-only.project-header .btn-freemode i {
		margin: 0;
		font-size: 16px;
	}

}

/* =============================================
   Tablet Breakpoint (769px ~ 1024px)
   모바일(768px 이하)에서는 적용되지 않도록 min-width 제한
   ============================================= */
@media (min-width: 768px) and (max-width: 1023px) {
	/* 정산 테이블: 부가 컬럼 숨김 */
	.settle-table th:nth-child(5),
	.settle-table td:nth-child(5),
	.settle-table th:nth-child(8),
	.settle-table td:nth-child(8),
	.settle-table th:nth-child(9),
	.settle-table td:nth-child(9) {
		display: none;
	}

}

/* =============================================
   Small Mobile Breakpoint (480px)
   ============================================= */
@media (max-width: 767px) {
	.app-content {
		padding: 8px !important;
	}

	/* 모달 전폭 */
	.modal-container {
		width: 100% !important;
		max-width: 100% !important;
		border-radius: var(--fm-radius-medium);
		max-height: 100vh;
	}

	/* 버튼 텍스트 축소 */
	.btn-freemode {
		font-size: 13px;
		padding: 8px 12px;
	}
}





/* 모바일 목록 하단은 총 건수와 페이지네이션을 한 열로 배치한다. */
@media (max-width: 767px) {
    .list-pagination-footer {
        grid-template-columns: 1fr;
        justify-items: center;
        padding: var(--fm-space-4) 0;
    }

    .list-result-count {
        justify-self: start;
    }

    .list-pagination-footer__spacer {
        display: none;
    }
}
