/* Pretendard Variable Font (로컬) */
@font-face {
	font-family: 'Pretendard';
	src: url('../vendor/fonts/PretendardVariable.woff2') format('woff2');
	font-weight: 45 920;
	font-style: normal;
	font-display: swap;
	size-adjust: 100%;
	ascent-override: 105%;
	descent-override: 18%;
	line-gap-override: 0%;
}

/* =========================================================================
   Mocha CRM Global Modern CSS
   ========================================================================= */

:root {
	/* 컬러 팔레트 */
	--mc-primary: #4361ee;
	--mc-primary-hover: #3a56d4;
	--mc-secondary: #f8f9fa;
	--mc-dark-bg: #1e293b;
	--mc-dark-hover: #334155;
	--mc-dark-active: #0f172a;
	--mc-text-main: #334155;
	--mc-text-muted: #64748b;
	--mc-bg-body: #f8fafc;
	--mc-border: #e2e8f0;
	
	/* 여백 및 모서리 */
	--mc-radius-sm: 6px;
	--mc-radius-md: 12px;
	--mc-radius-lg: 16px;
	
	/* 그림자 (Glassmorphism / Soft Drop) */
	--mc-shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
	--mc-shadow-hover: 0 10px 25px -4px rgba(0, 0, 0, 0.08);
}

body {
	font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, 'Helvetica Neue', 'Segoe UI', 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', sans-serif;
	background-color: var(--mc-bg-body);
	color: var(--mc-text-main);
	margin: 0;
}

/* 페이지 로드 시 부드러운 진입 (깜빡임 방지) */
.crm-main-content {
	animation: fadeInContent 0.15s ease-out;
}
@keyframes fadeInContent {
	from { opacity: 0.3; }
	to { opacity: 1; }
}

/* =========================================================================
   Layout (Sidebar & Main Content)
   ========================================================================= */
.crm-sidebar {
	position: fixed;
	left: 0;
	top: 0;
	width: 260px;
	height: 100vh;
	height: 100dvh;
	background: var(--mc-dark-bg);
	z-index: 1045;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	box-shadow: 2px 0 10px rgba(0,0,0,0.05);
	transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	padding-bottom: env(safe-area-inset-bottom, 0);
}

.crm-main-content {
	margin-left: 260px;
	padding: 24px 30px;
	min-height: 100vh;
	background: var(--mc-bg-body);
	display: flex;
	flex-direction: column;
}

/* =========================================================================
   Header 
   ========================================================================= */
.crm-header {
	background: #fff;
	padding: 18px 24px;
	margin: -24px -30px 24px -30px;
	border-bottom: 1px solid var(--mc-border);
	box-shadow: 0 2px 10px rgba(0,0,0,0.02);
	display: flex;
	justify-content: space-between;
	align-items: center;
	min-height: 68px;
	position: sticky;
	top: 0;
	z-index: 990;
}

.crm-header-title {
	margin-bottom: 0;
	font-weight: 700;
	font-size: 1.25rem;
	color: var(--mc-dark-bg);
}

.crm-header .branch-select {
	min-width: 150px;
	max-width: 200px;
	height: 38px;
}
/* Select2 변환 시 높이 고정 (CLS 방지) */
.crm-header .select2-container {
	height: 38px !important;
}
.crm-header .select2-container .select2-selection {
	height: 38px !important;
	line-height: 36px;
}

.crm-header .user-info {
	display: flex;
	align-items: center;
	gap: 15px;
	white-space: nowrap;
}

.crm-header .user-info a {
	display: inline-flex;
	align-items: center;
	color: var(--mc-text-main) !important;
	transition: color 0.2s;
}

.crm-header .user-info a:hover {
	color: var(--mc-primary) !important;
}

/* Breadcrumbs */
.mc-breadcrumb {
	font-size: 13px;
	color: var(--mc-text-muted);
	margin-bottom: 4px;
}
.mc-breadcrumb a {
	color: var(--mc-text-muted);
	text-decoration: none;
	transition: color 0.2s;
}
.mc-breadcrumb a:hover {
	color: var(--mc-primary);
}
.mc-breadcrumb .separator {
	margin: 0 6px;
	font-size: 10px;
	opacity: 0.5;
}

/* =========================================================================
   Card UI (Soft & Spacious)
   ========================================================================= */
.card-admin {
	background: #fff;
	box-shadow: var(--mc-shadow-card);
	border: 1px solid rgba(0,0,0,0.03);
	border-radius: var(--mc-radius-md);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	margin-bottom: 20px;
	overflow: hidden;
}

.card-admin.hover-lift:hover {
	transform: translateY(-4px);
	box-shadow: var(--mc-shadow-hover);
}

.card-admin .card-header {
	background: #fff;
	border-bottom: 1px solid var(--mc-border);
	padding: 18px 24px;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.card-admin .card-header .card-title {
	margin: 0;
	font-size: 1rem;
	font-weight: 700;
	color: var(--mc-text-main);
}

.card-admin .card-body {
	padding: 24px;
}

/* 요약 카드 */
.summary-card .summary-icon {
	width: 54px;
	height: 54px;
	min-width: 54px;
	border-radius: var(--mc-radius-md);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 24px;
	margin-right: 16px;
	background: var(--mc-secondary);
}

.summary-card .summary-content {
	display: flex;
	flex-direction: column;
	min-width: 0;
	flex: 1;
}

.summary-card .summary-label {
	font-size: 13px;
	color: var(--mc-text-muted);
	white-space: nowrap;
	margin-bottom: 4px;
	font-weight: 500;
}

.summary-card .summary-value {
	font-size: 24px;
	font-weight: 700;
	color: var(--mc-text-main);
	white-space: nowrap;
	min-width: 90px;
	min-height: 32px;
	line-height: 32px;
}

/* =========================================================================
   Sidebar Details
   ========================================================================= */
.crm-sidebar .logo {
	padding: 24px 20px;
	text-align: center;
	border-bottom: 1px solid rgba(255,255,255,0.05);
}

.crm-sidebar .logo h2 {
	color: #fff;
	margin: 0;
	font-size: 22px;
	font-weight: 700;
	letter-spacing: -0.5px;
}

/* 사용자+구독 통합 섹션 */
.user-subscription-section {
	padding: 20px 20px 15px 20px;
	background: rgba(255,255,255,0.03);
	border-bottom: 1px solid rgba(255,255,255,0.05);
	margin-bottom: 10px;
}

.user-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 12px;
}

.user-info {
	display: flex;
	align-items: center;
}

.user-icon {
	font-size: 24px;
	color: rgba(255,255,255,0.8);
	margin-right: 10px;
}

.user-name {
	color: #fff;
	font-size: 14px;
	font-weight: 600;
}

.btn-user-action {
	padding: 5px 8px;
	font-size: 12px;
	color: #fff;
	background-color: rgba(255, 255, 255, 0.1);
	border-radius: var(--mc-radius-sm);
	text-decoration: none;
	transition: background-color 0.2s;
}

.btn-user-action:hover {
	background-color: rgba(255, 255, 255, 0.25);
	color: #fff;
	text-decoration: none;
}

.btn-user-action.btn-logout:hover {
	background-color: rgba(220, 53, 69, 0.9);
}

/* 2~4행 정보 스타일링 */
.expire-row {
	display: flex; align-items: center; gap: 6px; padding: 8px 0; border-top: 1px dashed rgba(255, 255, 255, 0.1);
}
.days-text { font-size: 11px; font-weight: 600; color: rgba(255, 255, 255, 0.6); }
.days-text.warning { color: #f59e0b; }
.days-text.expired { color: #ef4444; }
.expire-date { font-size: 12px; color: #fff; font-weight: 500; }

.plan-row { display: flex; align-items: center; justify-content: space-between; padding-top: 6px; }
.plan-info { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.auto-renew-text { font-size: 11px; color: rgba(255, 255, 255, 0.5); }
.plan-badge { padding: 3px 6px; border-radius: var(--mc-radius-sm); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.plan-FREE { background-color: #64748b; color: #fff; }
.plan-BASIC { background-color: var(--mc-primary); color: #fff; }
.plan-PREMIUM { background: linear-gradient(135deg, #f59e0b, #ec4899); color: #fff; }

.auto-renew-badge { padding: 3px 6px; border-radius: var(--mc-radius-sm); font-size: 9px; font-weight: 700; }
.auto-renew-badge.on { background-color: #10b981; color: #fff; }
.auto-renew-badge.off { background-color: rgba(255, 255, 255, 0.1); color: rgba(255, 255, 255, 0.5); }

.balance-row { display: flex; align-items: center; justify-content: space-between; padding-top: 10px; margin-top: 10px; border-top: 1px dashed rgba(255, 255, 255, 0.1); }
.balance-info { display: flex; align-items: center; gap: 6px; }
.balance-icon { font-size: 14px; color: #f59e0b; }
.balance-label { font-size: 11px; color: rgba(255, 255, 255, 0.6); }
.balance-amount { font-size: 14px; font-weight: 700; color: #fff; }

.btn-charge { padding: 5px 12px; background-color: #10b981; color: #fff; text-decoration: none; border-radius: var(--mc-radius-sm); font-size: 11px; font-weight: 600; transition: background-color 0.2s; }
.btn-charge:hover { background-color: #059669; color: #fff; text-decoration: none; }
.btn-upgrade { padding: 5px 12px; background-color: rgba(255,255,255,0.1); color: #fff; text-decoration: none; border-radius: var(--mc-radius-sm); font-size: 11px; transition: background-color 0.2s; }
.btn-upgrade:hover { background-color: rgba(255,255,255,0.2); text-decoration: none; color: #fff;}


/* 네비게이션 메뉴 */
.crm-sidebar .nav-menu {
	padding: 10px 0;
	margin: 0;
	list-style: none;
}

.crm-sidebar .nav-menu > li > a {
	display: block;
	padding: 14px 24px;
	color: #94a3b8;
	text-decoration: none;
	font-weight: 500;
	font-size: 14px;
	transition: all 0.2s;
	border-left: 3px solid transparent;
}

.crm-sidebar .nav-menu > li > a:hover {
	background: var(--mc-dark-hover);
	color: #fff;
}

.crm-sidebar .nav-menu > li.active > a {
	background: var(--mc-dark-active);
	color: #fff;
	border-left: 3px solid var(--mc-primary);
}

.crm-sidebar .nav-menu > li > a i.fa-fw,
.crm-sidebar .nav-menu > li > a > i:first-child {
	margin-right: 12px;
	width: 20px;
	text-align: center;
	font-size: 16px;
	opacity: 0.8;
}

.crm-sidebar .nav-menu > li.active > a > i:first-child {
	color: var(--mc-primary);
	opacity: 1;
}

/* 서브메뉴 */
.crm-sidebar .nav-menu > li.has-submenu > a {
	position: relative;
}

.crm-sidebar .nav-menu > li.has-submenu > a .submenu-arrow {
	position: absolute;
	right: 20px;
	top: 50%;
	transform: translateY(-50%);
	transition: transform 0.3s;
	font-size: 12px;
}

.crm-sidebar .nav-menu > li.has-submenu.open > a .submenu-arrow {
	transform: translateY(-50%) rotate(180deg);
}

.crm-sidebar .submenu {
	display: none;
	list-style: none;
	padding: 5px 0;
	margin: 0;
	background: var(--mc-dark-active);
}

.crm-sidebar .submenu li a {
	display: block;
	padding: 10px 24px 10px 56px;
	color: #64748b;
	text-decoration: none;
	font-size: 13px;
	transition: all 0.2s;
	font-weight: 500;
}

.crm-sidebar .submenu li a:hover,
.crm-sidebar .submenu li.active a {
	color: #fff;
}
.crm-sidebar .submenu li.active a {
	font-weight: 600;
	color: var(--mc-primary);
}

.crm-sidebar .submenu li a i {
	margin-right: 10px;
	width: 16px;
	text-align: center;
}

/* =========================================================================
   Tables & Datatables
   ========================================================================= */
.table {
	margin-bottom: 0;
}

.table th {
	background: var(--mc-secondary);
	font-weight: 600;
	color: var(--mc-text-muted);
	border-bottom: 1px solid var(--mc-border);
	padding: 12px 16px;
	font-size: 13px;
	white-space: nowrap;
}

.table td {
	vertical-align: middle;
	padding: 12px 16px;
	font-size: 14px;
	color: var(--mc-text-main);
	border-bottom: 1px solid var(--mc-border);
}

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

/* =========================================================================
   Buttons & Inputs
   ========================================================================= */
.btn {
	border-radius: var(--mc-radius-sm);
	font-weight: 500;
	transition: all 0.2s ease;
}

.btn-primary {
	background-color: var(--mc-primary);
	border-color: var(--mc-primary);
}

.btn-primary:hover, .btn-primary:focus {
	background-color: var(--mc-primary-hover);
	border-color: var(--mc-primary-hover);
	transform: translateY(-1px);
	box-shadow: 0 4px 10px rgba(67, 97, 238, 0.2);
}
/* =========================================================================
   Global SaaS Components Overhaul (Forms, Buttons, Modals, Tables)
   ========================================================================= */

/* 1. Forms & Inputs */
.form-control, .form-select {
	border-radius: 8px; /* Softer radius */
	padding: 10px 14px;
	border: 1px solid #d1d5db; /* Tailwind gray-300 */
	font-size: 14px;
	background-color: #fff;
	color: var(--mc-text-main);
	transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.form-control::placeholder, .form-select::placeholder {
	color: #9ca3af; /* Tailwind gray-400 */
}
.form-control:focus, .form-select:focus {
	border-color: var(--mc-primary);
	box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.15); /* Modern Focus Ring */
	outline: none;
}
.form-label {
	font-weight: 600;
	color: #334155; /* Tailwind slate-700 */
	margin-bottom: 0.5rem;
	font-size: 0.9rem;
}
.input-group-text {
	border-radius: 8px;
	background-color: #f1f5f9;
	border-color: #d1d5db;
	color: #475569;
}

/* 2. Modals (Popups) */
.modal-content {
	border: none;
	border-radius: 16px;
	box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); /* Deep shadow */
	overflow: hidden;
}
.modal-header {
	background-color: #f8fafc; /* Very light slate */
	border-bottom: 1px solid #e2e8f0;
	padding: 1.25rem 1.5rem;
}
.modal-title {
	font-weight: 700;
	font-size: 1.15rem;
	color: #0f172a;
}
.modal-body {
	padding: 1.5rem;
}
.modal-footer {
	background-color: #f8fafc;
	border-top: 1px solid #e2e8f0;
	padding: 1.25rem 1.5rem;
}

/* 3. Buttons */
.btn {
	border-radius: 8px;
	font-weight: 600;
	padding: 0.5rem 1rem;
	transition: all 0.2s;
	font-size: 0.9rem;
}
.btn:hover {
	transform: translateY(-1px);
	box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}
.btn:active {
	transform: translateY(0);
}
.btn-primary {
	background-color: var(--mc-primary);
	border: none;
	color: #fff;
}
.btn-primary:hover {
	background-color: #364fc7; /* Darker primary */
	box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
}
.btn-secondary {
	background-color: #e2e8f0;
	color: #475569;
	border: none;
}
.btn-secondary:hover {
	background-color: #cbd5e1;
	color: #1e293b;
}

/* 4. Tables & Lists */
.table thead th {
	background-color: #f8fafc;
	color: #475569;
	font-size: 0.8rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	font-weight: 600;
	border-bottom: 2px solid #e2e8f0;
	padding: 12px 16px;
}
.table tbody td {
	padding: 12px 16px;
	vertical-align: middle;
	color: #334155;
	border-bottom: 1px solid #f1f5f9;
}
.table-hover tbody tr:hover {
	background-color: #f8fafc;
}

/* 5. Badges */
.badge {
	padding: 0.35em 0.65em;
	font-weight: 600;
	border-radius: 9999px; /* Pill shape */
}


/* 6. Pagination (Modern Detached Pills/Squares) */
.pagination {
	gap: 6px; /* Separate pagination items */
}
.page-item .page-link {
	border-radius: 8px; /* Rounded items */
	border: none;
	color: #475569;
	background-color: transparent;
	font-weight: 500;
	padding: 8px 14px;
	transition: all 0.2s;
}
.page-item:not(.active) .page-link:hover {
	background-color: #f1f5f9;
	color: #0f172a;
}
.page-item.active .page-link {
	background-color: var(--mc-primary);
	color: #fff;
	box-shadow: 0 4px 6px -1px rgba(67, 97, 238, 0.3);
}
.page-item.disabled .page-link {
	background-color: transparent;
	color: #cbd5e1;
}

/* 7. Nav Tabs (Sleek Underline Material/SaaS Style) */
.nav-tabs {
	border-bottom: 2px solid #e2e8f0;
	gap: 10px;
}
.nav-tabs .nav-link {
	border: none;
	border-bottom: 2px solid transparent;
	color: #64748b;
	font-weight: 600;
	padding: 10px 16px;
	margin-bottom: -2px; /* Align overlap with tab container border */
	transition: all 0.2s;
	background: transparent;
}
.nav-tabs .nav-link:hover {
	color: #334155;
	border-color: #cbd5e1;
}
.nav-tabs .nav-link.active {
	color: var(--mc-primary);
	border-color: var(--mc-primary);
	background: transparent;
}

/* =========================================================================
   Loading Overlay & Empty State
   ========================================================================= */
.loading-overlay {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(255, 255, 255, 0.4);
	backdrop-filter: blur(2px);
	z-index: 9999;
	justify-content: center;
	align-items: center;
}
.loading-overlay.show { display: flex; }
.loading-overlay .spinner-border {
	width: 3rem; height: 3rem;
	color: var(--mc-primary);
}

.empty-state {
	text-align: center;
	padding: 60px 20px;
}
.empty-state-icon {
	font-size: 48px;
	color: #cbd5e1;
	margin-bottom: 20px;
}
.empty-state-title {
	font-size: 18px;
	font-weight: 700;
	color: var(--mc-text-main);
	margin-bottom: 8px;
}
.empty-state-desc {
	font-size: 14px;
	color: var(--mc-text-muted);
	margin-bottom: 24px;
}

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 1199px) {
	.crm-sidebar { transform: translateX(-100%); }
	.crm-sidebar.active { transform: translateX(0); }
	.crm-main-content { margin-left: 0; padding: 16px; }
	.crm-header {
		margin: -16px -16px 16px -16px;
		padding: 16px;
		flex-wrap: wrap;
	}
	.crm-header-title { white-space: nowrap; font-size: 1.1rem; }
}

@media (max-width: 767px) {
	/* 모바일 헤더: 한 줄 고정(햄버거 · 페이지명 · 사업장 · 사용자 · 로그아웃) */
	.crm-header {
		flex-direction: row !important;
		flex-wrap: nowrap !important;
		align-items: center !important;
		gap: 6px;
		padding: 8px 10px !important;
		min-height: 48px;
	}
	.crm-header > .d-flex {
		width: auto !important;
		flex-wrap: nowrap !important;
	}
	.crm-header-left {
		flex: 1 1 auto;
		min-width: 0;
	}
	.crm-header-right {
		flex: 0 0 auto;
		gap: 4px;
	}
	.crm-header #sidebarToggle {
		flex: 0 0 auto;
	}
	.crm-header-title {
		font-size: 0.95rem !important;
		margin-bottom: 0;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
		min-width: 0;
	}
	.crm-header .mc-breadcrumb { display: none !important; }
	.crm-header .vr { display: none !important; }
	/* 사업장 select 축소 */
	.crm-header .branch-select + .select2,
	.crm-header .select2-container {
		width: 110px !important;
		flex: 0 0 110px;
		max-width: 110px !important;
	}
	.crm-header .select2-container--bootstrap-5 .select2-selection--single {
		height: 32px !important;
		min-height: 32px !important;
		padding: 2px 6px !important;
		font-size: 0.8rem !important;
	}
	.crm-header .select2-container--bootstrap-5 .select2-selection__rendered {
		line-height: 28px !important;
		padding: 0 !important;
	}
	/* 사용자 아이콘만 */
	.crm-header-user {
		font-size: 1.2rem;
		color: #6c757d;
		line-height: 1;
		padding: 0 2px;
	}
	.crm-header-user i { font-size: 1.3rem; }
	/* 로그아웃 아이콘 버튼 */
	.crm-header form[action*="logout"] { margin: 0 !important; }
	.crm-header form[action*="logout"] .btn {
		padding: 4px 8px !important;
		font-size: 0.85rem !important;
		line-height: 1;
	}
	.crm-header .logout-label { display: none !important; }
	.card-admin .card-header { padding: 16px; flex-wrap: wrap; gap: 10px; }
	.card-admin .card-body { padding: 16px; }

	/* 테이블 카드 변환: JS 자동 변환 제거됨 — table-responsive-card 클래스로 opt-in */
	.summary-card .summary-icon { width: 44px; height: 44px; min-width: 44px; font-size: 20px; }
	.summary-card .summary-value { font-size: 18px; }

	/* 모바일 반응형 데이터테이블 (Table to Card 자동화) */
	.table.mobile-card-table, 
	.table.mobile-card-table tbody, 
	.table.mobile-card-table th, 
	.table.mobile-card-table td, 
	.table.mobile-card-table tr { 
		display: block; 
		width: 100%;
	}
	/* 헤더 숨기기 (공간 완전 제거) */
	.table.mobile-card-table thead { 
		display: none;
	}
	/* 각 행을 카드로 만들기 */
	.table.mobile-card-table tbody tr { 
		margin-bottom: 16px;
		background: #fff;
		border: 1px solid var(--mc-border);
		border-radius: var(--mc-radius-md);
		padding: 12px;
		box-shadow: 0 2px 4px rgba(0,0,0,0.02);
	}
	/* 마지막 행 여백 제거 */
	.table.mobile-card-table tbody tr:last-child {
		margin-bottom: 0;
	}
	/* 기존 테이블 테두리 초기화 */
	.table.mobile-card-table > :not(caption) > * > * {
		border-bottom: 1px solid var(--mc-border);
		padding: 10px 0;
	}
	.table.mobile-card-table > tbody > tr > td:last-child {
		border-bottom: none;
	}
	/* Data Label (항목명) 표시 */
	.table.mobile-card-table td { 
		position: relative;
		padding-left: 40% !important; 
		text-align: right;
		min-height: 40px;
		display: flex;
		align-items: center;
		justify-content: flex-end;
		word-break: break-all;
	}
	.table.mobile-card-table td::before { 
		content: attr(data-label);
		position: absolute;
		left: 0;
		width: 35%;
		padding-right: 10px;
		white-space: nowrap;
		text-align: left;
		font-weight: 600;
		color: var(--mc-text-muted);
		font-size: 0.9em;
	}
	/* 반응형 테이블 컨테이너 패딩 등 정리 */
	.table-responsive {
		border: none !important;
	}
}


/* ============================================================
   그리드 액션 버튼 - 아이콘 전용 컴팩트 스타일
   (관리 열의 수정/삭제 등 버튼이 너무 커지는 문제 방지)
   ============================================================ */
.btn-grid-action {
	padding: 0.2rem 0.45rem;
	font-size: 0.8rem;
	line-height: 1.2;
	border-radius: 4px;
}
.btn-grid-action + .btn-grid-action {
	margin-left: 4px;
}
.btn-grid-action i {
	font-size: 0.85rem;
}


/* ============================================================
   반응형 정책 (Mocha CRM Responsive Framework)
   ------------------------------------------------------------
   Breakpoints
     - 모바일:   ≤ 640px
     - 태블릿:   641px ~ 1024px
     - 데스크탑: ≥ 1025px

   사용법: 카드뷰 전환이 필요한 테이블에 `table-responsive-card`
   클래스를 추가하고, 각 <td>에 data-label="컬럼명"을 지정한다.
   태블릿 이하에서 자동으로 행이 카드 형태로 펼쳐진다.
   ============================================================ */

@media (max-width: 1024px) {
	/* 1) responsive-card 테이블의 헤더 숨김 */
	.table-responsive-card thead {
		display: none !important;
	}
	/* 2) 행을 카드처럼 블록 표시 */
	.table-responsive-card,
	.table-responsive-card tbody,
	.table-responsive-card tr,
	.table-responsive-card td {
		display: block !important;
		width: 100% !important;
	}
	.table-responsive-card tr {
		margin-bottom: 12px;
		border: 1px solid #e2e8f0;
		border-radius: 8px;
		padding: 10px 12px;
		background: #fff;
		box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
	}
	/* 3) 각 셀: 라벨 + 값을 좌우로 배치 */
	.table-responsive-card td {
		border: none !important;
		padding: 6px 0 !important;
		display: flex !important;
		justify-content: space-between !important;
		align-items: center !important;
		gap: 12px;
		text-align: right !important;
	}
	.table-responsive-card td::before {
		content: attr(data-label);
		font-weight: 600;
		color: #64748b;
		font-size: 0.85rem;
		text-align: left;
		flex: 0 0 auto;
		min-width: 90px;
	}
	/* 4) 긴 내용 셀 — 가로 배치 대신 세로 배치, max-width 해제 */
	.table-responsive-card td[style*="max-width"] {
		max-width: none !important;
		flex-direction: column !important;
		align-items: flex-start !important;
		text-align: left !important;
		word-break: break-word;
	}
	.table-responsive-card td[style*="max-width"]::before {
		margin-bottom: 4px;
	}
	/* 5) 빈값 셀(액션 없는 셀) 숨기기 - data-label 없는 빈 td */
	.table-responsive-card td:empty {
		display: none !important;
	}
	/* 5) 카드 내 액션 버튼 영역 — 다른 셀과 동일한 label(좌측) + 버튼(우측) 구조 유지.
	      이전에는 justify-content: flex-end 로 라벨까지 숨겨졌던 탓에 '관리'만 레이아웃이 달라 보였음.
	      버튼이 많을 때는 줄바꿈 허용. */
	.table-responsive-card td[data-label="관리"],
	.table-responsive-card td[data-label="액션"] {
		flex-wrap: wrap;
	}
	/* 6) 첫 td(보통 번호 또는 식별자) 숨기는 옵션 */
	.table-responsive-card.hide-first-col td:first-child,
	.table-responsive-card.hide-first-col th:first-child {
		display: none !important;
	}

	/* 7) 일반 카드 액션바 - 검색 영역의 row 간격 보정 */
	.card-admin .card-body .row.g-3 > [class*="col-"] {
		margin-bottom: 8px;
	}
}

/* 모바일 전용 보강 */
@media (max-width: 640px) {
	.table-responsive-card td::before {
		min-width: 80px;
		font-size: 0.8rem;
	}
	.card-admin .card-header {
		flex-wrap: wrap;
		gap: 8px;
	}
	.card-admin .card-actions {
		flex-wrap: wrap;
		gap: 4px;
	}
	/* 검색 폼의 버튼 그룹은 가로 폭 채우기 */
	.btn-group-mobile-full > .btn {
		flex: 1 1 auto;
	}
}

/* 태블릿 전용: 사이드바 본문 패딩 축소, 카드 padding 축소 */
@media (min-width: 641px) and (max-width: 1024px) {
	.container-fluid {
		padding-left: 12px !important;
		padding-right: 12px !important;
	}
	.card-admin .card-body {
		padding: 14px !important;
	}
	.card-admin .card-header {
		padding: 12px 14px !important;
	}
}

/* ============================================================
   모달 반응형 최적화
   - 태블릿/모바일에서 모달 폭과 여백을 편하게 조정
   ============================================================ */
@media (max-width: 1024px) {
	.modal-dialog {
		max-width: calc(100% - 20px) !important;
		margin: 10px auto !important;
	}
	.modal-dialog.modal-lg,
	.modal-dialog.modal-xl {
		max-width: calc(100% - 20px) !important;
	}
	.modal-body {
		padding: 14px !important;
		max-height: calc(100vh - 140px);
		overflow-y: auto;
	}
	.modal-header {
		padding: 12px 14px !important;
	}
	.modal-footer {
		padding: 10px 14px !important;
		flex-wrap: wrap;
		gap: 6px;
	}
	.modal-footer > .btn {
		margin: 0 !important;
	}
}

@media (max-width: 640px) {
	.modal-dialog {
		max-width: calc(100% - 24px) !important;
		margin: 12px auto !important;
	}
	.modal-content {
		border-radius: 8px !important;
	}
	.modal-body {
		max-height: calc(100vh - 160px);
	}
	/* 모바일에서 모달 푸터 버튼 풀 폭 */
	.modal-footer > .btn {
		flex: 1 1 100%;
	}
}

/* ============================================================
   검색 폼 하단 버튼 영역 태블릿 정렬
   ============================================================ */
@media (max-width: 1024px) {
	.card-admin .card-body form .row.mt-3 > .col-12 {
		display: flex;
		flex-wrap: wrap;
		gap: 6px;
		justify-content: center;
	}
	.card-admin .card-body form .row.mt-3 .btn {
		flex: 0 1 auto;
	}
}

/* ============================================================
   카드뷰 내부 카테고리 depth 들여쓰기 무효화
   - 데스크탑에서는 padding-left 들여쓰기가 의미 있으나
     카드뷰에서는 <td>가 flex 박스로 바뀌어 들여쓰기가 깨짐
   ============================================================ */
@media (max-width: 1024px) {
	.table-responsive-card td[data-label="카테고리명"] span[style*="padding-left"] {
		padding-left: 0 !important;
	}
	.table-responsive-card td[data-label="카테고리명"] .fa-level-up-alt {
		display: none !important;
	}
}

/* ============================================================
   카드 헤더 태블릿 정렬 보정
   - card-title과 card-actions가 좁은 폭에서 줄바꿈되도록
   ============================================================ */
@media (max-width: 1024px) {
	.card-admin .card-header {
		flex-wrap: wrap;
		gap: 8px;
	}
	.card-admin .card-actions {
		flex-wrap: wrap;
		gap: 6px;
		align-items: center;
	}
	.card-admin .card-actions .btn {
		flex: 0 1 auto;
	}
	.card-admin .card-actions > span.text-muted {
		margin-right: 8px !important;
	}
}

/* ============================================================
   Chart.js 반응형
   - canvas 부모에 명확한 높이를 주어 태블릿에서도 정상 렌더링
   ============================================================ */
.card-admin .card-body > canvas,
.card-admin .card-body canvas[id$="Chart"] {
	max-width: 100% !important;
	height: auto !important;
}

@media (max-width: 1024px) {
	.card-admin .card-body canvas[id$="Chart"] {
		max-height: 320px;
	}
}

@media (max-width: 640px) {
	.card-admin .card-body canvas[id$="Chart"] {
		max-height: 260px;
	}
}

/* ============================================================
   SweetAlert2 한글 가독성 개선
   - keep-all: 한글이 음절 중간에서 줄바꿈되지 않고 단어/어절 단위로 줄바꿈
   - 기본 popup 폭 확장으로 긴 안내 문구가 덜 자주 줄바꿈되도록
   ============================================================ */
.swal2-popup {
	max-width: 560px !important;
	width: auto !important;
}
.swal2-html-container,
.swal2-title {
	word-break: keep-all !important;
	overflow-wrap: break-word !important;
}
@media (max-width: 640px) {
	.swal2-popup {
		max-width: calc(100% - 24px) !important;
	}
}

/* ============================================================
   Select2 사업장 선택: clear(X) 버튼 제거 + 높이 정렬
   ============================================================ */
.crm-header .select2-selection__clear,
.crm-header .select2-selection--clearable .select2-selection__clear {
	display: none !important;
}
.crm-header .select2-container--bootstrap-5 .select2-selection--single {
	height: 38px;
	display: flex;
	align-items: center;
}
.crm-header .select2-container--bootstrap-5 .select2-selection__rendered {
	line-height: 38px;
	padding-right: 24px !important;
}

/* 모바일에서 로그아웃 버튼은 아이콘만 표시 (폭 확보) */
@media (max-width: 767px) {
	.crm-header .user-info .btn .logout-label {
		display: none;
	}
	.crm-header .user-info .btn {
		padding: 6px 10px;
	}
}

/* ============================================================
   플로팅 퀵버튼 그룹 (FAB Quick Menu)
   - 우측 하단 고정, 토글로 3개 버튼 펼침
   ============================================================ */
.fab-quick-group {
	position: fixed;
	right: 24px;
	bottom: 24px;
	z-index: 1040;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 10px;
}
.fab-quick-toggle {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 14px 22px;
	background: #333;
	color: #fff;
	font-weight: 600;
	font-size: 0.95rem;
	border: none;
	border-radius: 50px;
	box-shadow: 0 4px 12px rgba(0,0,0,0.15);
	transition: all 0.2s ease;
	cursor: pointer;
	white-space: nowrap;
}
.fab-quick-toggle:hover {
	background: #555;
	transform: translateY(-1px);
	box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}
.fab-quick-toggle i {
	font-size: 1.1rem;
	transition: transform 0.3s ease;
}
.fab-quick-group.open .fab-quick-toggle i {
	transform: rotate(45deg);
}
.fab-quick-items {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 8px;
	opacity: 0;
	transform: translateY(10px) scale(0.9);
	pointer-events: none;
	transition: all 0.2s ease;
}
.fab-quick-group.open .fab-quick-items {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}
.fab-quick-item {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 18px;
	background: #fff;
	color: var(--mc-text-main) !important;
	text-decoration: none !important;
	font-weight: 500;
	font-size: 0.875rem;
	border-radius: 50px;
	box-shadow: 0 2px 8px rgba(0,0,0,0.08);
	transition: all 0.15s ease;
	white-space: nowrap;
}
.fab-quick-item:hover {
	background: #333;
	color: #fff !important;
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.fab-quick-item i {
	font-size: 1rem;
	width: 20px;
	text-align: center;
	color: #333;
}
.fab-quick-item:hover i {
	color: #fff;
}
/* 모바일/태블릿: 원형 아이콘만 */
@media (max-width: 1024px) {
	.fab-quick-group { right: 16px; bottom: 16px; }
	.fab-quick-toggle {
		width: 56px; height: 56px; padding: 0;
		justify-content: center; border-radius: 50%;
	}
	.fab-quick-toggle-label { display: none; }
	.fab-quick-toggle i { font-size: 1.4rem; }
	.fab-quick-item {
		padding: 0; width: 48px; height: 48px;
		border-radius: 50%; justify-content: center;
	}
	.fab-quick-label { display: none; }
	.fab-quick-item i { font-size: 1.2rem; margin: 0; }
}

/* ============================================================
   Badge 글꼴 가독성 개선 (기본 Bootstrap 배지가 너무 작음)
   ============================================================ */
.badge {
	font-size: 0.8rem !important;
	font-weight: 600;
	padding: 0.35em 0.6em;
	letter-spacing: -0.2px;
}
.badge.badge-sm,
.badge-sm {
	font-size: 0.72rem !important;
	padding: 0.28em 0.5em;
}

/* 모바일에서는 더 크게 — 터치 디바이스 가독성 */
@media (max-width: 767px) {
	.badge {
		font-size: 0.85rem !important;
		padding: 0.4em 0.7em;
	}
}

/* ============================================================
   카드 헤더 모바일: 버튼 많은 페이지(카테고리 등) 배치 개선
   ============================================================ */
@media (max-width: 767px) {
	.card-admin .card-header {
		flex-direction: column;
		align-items: flex-start !important;
		gap: 10px;
	}
	.card-admin .card-header .card-title {
		width: 100%;
		font-size: 1rem;
		margin-bottom: 0;
	}
	.card-admin .card-header .card-actions {
		width: 100%;
		display: flex;
		flex-wrap: wrap;
		gap: 6px;
		align-items: center;
		margin: 0 !important;
	}
	.card-admin .card-header .card-actions > span.text-muted {
		flex: 1 1 100%;
		margin: 0 0 4px 0 !important;
		font-size: 0.85rem;
	}
	.card-admin .card-header .card-actions .btn,
	.card-admin .card-header .card-actions > a.btn {
		flex: 1 1 auto;
		min-width: 0;
		margin: 0 !important;
		padding: 7px 10px;
		font-size: 0.82rem;
		white-space: nowrap;
	}
	.card-admin .card-header .card-actions .btn i {
		margin-right: 3px;
	}
}

/* ============================================================
   모바일 사이드바 오버레이 + 닫기
   - 사이드바가 열렸을 때 본문 위에 반투명 오버레이
   - 오버레이 탭 시 사이드바 자동 닫기
   - 사이드바 내부 링크 탭 시에도 자동 닫기
   ============================================================ */
.crm-sidebar-overlay {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	background: rgba(15, 23, 42, 0.5);
	z-index: 1044;	/* sidebar(1045)보다 낮게 — 사이드바는 위, 본문은 아래 */
}
.crm-sidebar.active ~ .crm-sidebar-overlay,
body.sidebar-open .crm-sidebar-overlay {
	display: block;
}
@media (min-width: 1200px) {
	.crm-sidebar-overlay {
		display: none !important;
	}
}

/* ============================================================
   responsive-card / mobile-card-table 빈 상태 행 예외
   - "데이터가 없습니다" 같은 colspan 셀은 카드 변환 없이
     가운데 정렬된 전체 폭 블록으로 표시
   ============================================================ */
@media (max-width: 1024px) {
	.table-responsive-card td[colspan],
	.table.mobile-card-table td[colspan] {
		display: block !important;
		width: 100% !important;
		padding: 40px 16px !important;
		text-align: center !important;
		justify-content: center !important;
		min-height: 0 !important;
		border: none !important;
	}
	.table-responsive-card td[colspan]::before,
	.table.mobile-card-table td[colspan]::before {
		display: none !important;
		content: none !important;
	}
	/* 빈 상태 단일 행: 카드 배경/테두리 제거 (데이터 없을 때만 단일 tr) */
	.table-responsive-card tbody tr:only-child,
	.table.mobile-card-table tbody tr:only-child {
		background: transparent !important;
		border: none !important;
		padding: 0 !important;
		margin: 0 !important;
		box-shadow: none !important;
	}
}

/* 모바일 헤더 추가 오버라이드는 상단 @media 블록(767px)에서 모두 처리됨 */

/* 초소형 모바일 (≤360px)에서 사용자명 더 줄이기 */
@media (max-width: 400px) {
	.crm-header .user-info a .user-name {
		max-width: 55px;
	}
	.crm-header-title {
		font-size: 0.92rem !important;
	}
}

/* ============================================================
   상품 목록의 카테고리/유형 배지 톤 다운
   - 카테고리: 회색 outline 스타일로 중립화 (같은 bg-primary 대량 노출 방지)
   - 유형: SERVICE(파랑), GOODS(노랑)만 단색 유지
   ============================================================ */
#productTable .badge.bg-primary {
	background-color: #e9ecef !important;
	color: #495057 !important;
	border: 1px solid #dee2e6;
	font-weight: 500;
}

/* ============================================================
   모바일/태블릿 모달 스와이프 다운 닫기
   - 모달 상단에 드래그 핸들바 표시
   - 아래로 스와이프하면 모달 닫힘
   ============================================================ */
@media (max-width: 1024px) {
	/* 모달 컨텐츠에 스와이프 핸들바 추가 */
	.modal-content {
		position: relative;
	}
	.modal-content::before {
		content: '';
		display: block;
		width: 40px;
		height: 4px;
		background: #ced4da;
		border-radius: 2px;
		margin: 8px auto 0;
		flex-shrink: 0;
	}
	/* 스와이프 중 모달 이동 애니메이션 */
	.modal-dialog.swiping {
		transition: none !important;
	}
	.modal-dialog.swipe-closing {
		transition: transform 0.25s ease-out, opacity 0.25s ease-out !important;
		opacity: 0;
	}
}
