/* ═══════════════════════════════════════════════════════════
   ERP 인사관리 시스템 – 글로벌 스타일
   ═══════════════════════════════════════════════════════════ */

/* 리셋 & 기본 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: 'Pretendard', 'Segoe UI', 'Malgun Gothic', -apple-system, sans-serif;
  font-size: 13.5px;
  color: #1e293b;
  background: #f1f5f9;
  height: 100%;
  -webkit-font-smoothing: antialiased;
}

/* ─── CSS 변수 ─────────────────────────────────────────────── */
:root {
  --sidebar-w: 220px;
  --topbar-h: 54px;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-light: #eff6ff;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --purple: #8b5cf6;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.12), 0 4px 10px rgba(0,0,0,.06);
}

/* ─── 전체 레이아웃 ─────────────────────────────────────────── */
#root { display: flex; height: 100vh; overflow: hidden; }
/* 로그인/회원가입 화면: #root flex 해제하고 full-page 처리 */
#root:has(.login-bg),
#root:has(.register-bg) { display: block; height: 100vh; overflow: auto; }

/* ─── 사이드바 ──────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  background: #0f172a;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  transition: width 0.25s ease;
  z-index: 100;
}

#sidebar .logo {
  height: var(--topbar-h);
  padding: 0 16px;
  background: #020617;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
#sidebar .logo .logo-icon {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: #fff; flex-shrink: 0;
}
#sidebar .logo .logo-text { font-size: 14px; font-weight: 700; color: #f1f5f9; white-space: nowrap; }
#sidebar .logo .logo-text span { color: #38bdf8; }

#sidebar .sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 0 16px;
}
#sidebar .sidebar-scroll::-webkit-scrollbar { width: 4px; }
#sidebar .sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

#sidebar .menu-group { padding: 4px 0; }
#sidebar .menu-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.2px; color: #475569;
  padding: 12px 16px 4px;
  white-space: nowrap;
}
#sidebar .menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px;
  cursor: pointer; font-size: 13px; color: #94a3b8;
  transition: all 0.15s;
  border-left: 3px solid transparent;
  white-space: nowrap;
  border-radius: 0;
  user-select: none;
}
#sidebar .menu-item:hover {
  background: rgba(255,255,255,.06);
  color: #e2e8f0;
  border-left-color: rgba(56,189,248,.4);
}
#sidebar .menu-item.active {
  background: rgba(59,130,246,.15);
  color: #38bdf8;
  border-left-color: #38bdf8;
  font-weight: 600;
}
#sidebar .menu-item i {
  width: 16px; text-align: center;
  font-size: 13px; flex-shrink: 0;
}

/* 사이드바 하단 사용자 정보 */
#sidebar .sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
  font-size: 12px;
  color: #64748b;
}

/* ─── 메인 영역 ─────────────────────────────────────────────── */
#main-content {
  flex: 1;
  min-width: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

/* ─── 탑바 ──────────────────────────────────────────────────── */
#topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 12px;
}
#topbar-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* ─── 페이지 콘텐츠 ─────────────────────────────────────────── */
#page-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  min-height: 0;
}

/* ─── 페이지 헤더 ───────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 10px;
}
.page-header-left {}
.page-header h2 {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.page-header p {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 3px;
}
.page-header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ─── 카드 ──────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.card-header h3 { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.card-body { padding: 18px; }
.card-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-card .icon-wrap {
  position: absolute; right: 14px; top: 14px;
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; opacity: 0.25;
}

/* ─── 테이블 ─────────────────────────────────────────────────── */
.erp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.erp-table thead {
  position: sticky; top: 0; z-index: 1;
}
.erp-table th {
  background: #f8fafc;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12px;
  padding: 7px 8px;
  text-align: left;
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
}
.erp-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: middle;
}
.erp-table tr:last-child td { border-bottom: none; }
.erp-table tbody tr:hover td { background: #f8faff; }

/* 고정 레이아웃 테이블 (휴직자 현황 등) */
.erp-table-fixed {
  table-layout: fixed;
  width: 100%;
}
.erp-table-fixed th {
  white-space: normal;
  word-break: keep-all;
  text-align: center !important;
  overflow: hidden;
}
.erp-table-fixed td {
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  vertical-align: middle;
}

/* 테이블 컨테이너 (스크롤) */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}

/* ─── 버튼 ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  cursor: pointer; border: none;
  transition: all 0.15s;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-secondary { background: #f1f5f9; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--border); }

.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #059669; }

.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }

.btn-warning   { background: var(--warning); color: #fff; }
.btn-warning:hover:not(:disabled) { background: #d97706; }

.btn-warn      { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.btn-warn:hover:not(:disabled) { background: #fde68a; }

.btn-purple    { background: var(--purple); color: #fff; }
.btn-purple:hover:not(:disabled) { background: #7c3aed; }

.btn-ghost     { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--border-light); }

.btn-sm  { padding: 4px 10px; font-size: 12px; border-radius: 5px; }
.btn-lg  { padding: 10px 20px; font-size: 14px; }
.btn-icon { padding: 6px; width: 32px; height: 32px; justify-content: center; }

/* ─── 배지 ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  white-space: nowrap;
}
.badge-green  { background: #dcfce7; color: #166534; }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-sky    { background: #e0f2fe; color: #075985; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-gray   { background: #f1f5f9; color: #475569; }
.badge-purple { background: #ede9fe; color: #5b21b6; }
.badge-cyan   { background: #cffafe; color: #155e75; }
.badge-orange { background: #ffedd5; color: #9a3412; }
.badge-pink   { background: #fce7f3; color: #9d174d; }

/* ─── 폼 ────────────────────────────────────────────────────── */
.form-label {
  display: block;
  font-size: 12px; font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  font-size: 13px;
  color: var(--text-primary);
  background: #fff;
  outline: none;
  transition: border 0.15s, box-shadow 0.15s;
  font-family: inherit;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,.1);
}
.form-input:read-only { background: #f8fafc; color: var(--text-muted); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-select { appearance: auto; }

.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-row { display: grid; gap: 12px; }
.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row-4 { grid-template-columns: repeat(4, 1fr); }

/* ─── 모달 ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(2px);
}
.modal-box {
  background: var(--surface);
  border-radius: 14px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.modal-header h3 { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 20px; line-height: 1;
  padding: 2px; border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.modal-close:hover { color: var(--text-primary); background: var(--border-light); }
.modal-body { padding: 20px; flex: 1; overflow-y: auto; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

/* ─── 탭 ────────────────────────────────────────────────────── */
.tab-bar {
  display: flex; gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 18px;
  overflow-x: auto;
}
.tab-bar::-webkit-scrollbar { height: 0; }
.tab-btn {
  padding: 9px 16px;
  font-size: 13px; font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
  white-space: nowrap;
  background: none; border-top: none; border-left: none; border-right: none;
}
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }
.tab-btn:hover:not(.active) { color: var(--text-primary); background: var(--border-light); }

/* ─── 검색/필터 바 ──────────────────────────────────────────── */
.search-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.search-wrap { position: relative; }
.search-wrap i {
  position: absolute; left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted); font-size: 13px;
  pointer-events: none;
}
.search-input {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 12px 7px 32px;
  font-size: 13px; outline: none;
  width: 210px; transition: border 0.15s;
}
.search-input:focus { border-color: var(--accent); }

/* ─── 로딩/스피너 ───────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 20px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ─── 토스트 ─────────────────────────────────────────────────── */
#toast-container {
  position: fixed; top: 20px; right: 20px;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
  max-width: 340px; width: 100%;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; color: #fff;
  box-shadow: var(--shadow-md);
  animation: slideIn .25s ease;
  word-break: break-all;
}
.toast-success { background: #059669; }
.toast-error   { background: #dc2626; }
.toast-info    { background: var(--accent); }
.toast-warning { background: var(--warning); }
@keyframes slideIn { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ─── 로그인 화면 ────────────────────────────────────────────── */
.login-bg {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.login-card {
  background: var(--surface);
  border-radius: 18px;
  padding: 40px;
  width: 100%; max-width: 420px;
  box-shadow: 0 25px 60px rgba(0,0,0,.4);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  border-radius: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
  box-shadow: 0 8px 20px rgba(59,130,246,.4);
}
.login-logo h1 { font-size: 22px; font-weight: 800; color: var(--text-primary); }
.login-logo p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ─── 회원가입 화면 ──────────────────────────────────────────── */
.register-bg {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.register-card {
  background: var(--surface);
  border-radius: 18px;
  padding: 36px;
  width: 100%; max-width: 700px;
  box-shadow: 0 25px 60px rgba(0,0,0,.4);
}
.step-indicator { display: flex; align-items: center; justify-content: center; margin-bottom: 28px; gap: 0; }
.step-dot {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; transition: all 0.3s;
}
.step-dot.active   { background: var(--accent); color: #fff; }
.step-dot.done     { background: var(--success); color: #fff; }
.step-dot.inactive { background: var(--border); color: var(--text-muted); }
.step-line { width: 60px; height: 2px; }
.step-line.done    { background: var(--success); }
.step-line.inactive { background: var(--border); }

/* ─── 유틸리티 ──────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state i { font-size: 40px; margin-bottom: 14px; display: block; opacity: 0.4; }
.empty-state p { font-size: 14px; }
.empty-state .empty-title { font-size: 15px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }

.section-divider { border: none; border-top: 1px solid var(--border-light); margin: 18px 0; }

.input-group { display: flex; gap: 8px; }
.input-group .form-input { flex: 1; }

.num-positive { color: #059669; font-weight: 600; }
.num-negative { color: var(--danger); font-weight: 600; }
.num-large { font-size: 22px; font-weight: 700; }

.text-muted  { color: var(--text-muted); }
.text-sm     { font-size: 12px; }
.text-right  { text-align: right; }
.text-center { text-align: center; }
.fw-bold     { font-weight: 700; }

/* ─── 거래처 상세 카드 ──────────────────────────────────────── */
.client-detail-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 14px;
}
.client-detail-section h4 {
  font-size: 12px; font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 10px;
  text-transform: uppercase; letter-spacing: 0.5px;
}

/* ─── 페이지네이션 ──────────────────────────────────────────── */
.pagination {
  display: flex; gap: 4px; align-items: center;
  margin-top: 14px; flex-wrap: wrap;
}
.page-btn {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  cursor: pointer; font-size: 12px;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.page-btn:hover:not(:disabled)  { background: var(--accent-light); border-color: var(--accent); color: var(--accent); }
.page-btn.active  { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 700; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ─── 정보 박스 ─────────────────────────────────────────────── */
.info-box {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  display: flex; align-items: flex-start; gap: 8px;
}
.info-box-blue   { background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; }
.info-box-yellow { background: #fefce8; border: 1px solid #fde68a; color: #92400e; }
.info-box-green  { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.info-box-red    { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }

/* ─── 스크롤바 ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ─── 반응형 ─────────────────────────────────────────────────── */
@media (max-width: 900px) {
  :root { --sidebar-w: 200px; }
  #page-content { padding: 14px 16px; }
}
@media (max-width: 768px) {
  #sidebar {
    position: fixed;
    left: -100%;
    transition: left 0.25s ease;
    z-index: 200;
    box-shadow: var(--shadow-lg);
  }
  #sidebar.mobile-open { left: 0; }
  #sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 199;
  }
  #sidebar-overlay.active { display: block; }
  #main-content { width: 100%; }
  #page-content { padding: 12px; }
  .form-row-2, .form-row-3, .form-row-4 { grid-template-columns: 1fr; }
}

/* ─── 프린트 ─────────────────────────────────────────────────── */
@media print {
  #sidebar, #topbar, .no-print, #toast-container { display: none !important; }
  #root { display: block; height: auto; }
  #main-content { height: auto; overflow: visible; }
  #page-content { padding: 0; height: auto; overflow: visible; }
  .card { box-shadow: none; border: 1px solid #ddd; }
  body { background: #fff; }
}

/* ─── 유틸리티 클래스 (Tailwind-like) ──────────────────────── */
/* Margin */
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.mb-6 { margin-bottom: 24px; }
.ml-1 { margin-left: 4px; }
.ml-2 { margin-left: 8px; }
.mr-1 { margin-right: 4px; }
.mr-2 { margin-right: 8px; }
.mx-auto { margin-left: auto; margin-right: auto; }

/* Gap */
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

/* Width */
.w-full { width: 100%; }

/* Flex */
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; }
.flex-col { flex-direction: column; }

/* Grid helpers */
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 16px; margin-bottom: 16px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }

/* Text colors */
.text-blue   { color: #3b82f6; }
.text-green  { color: #10b981; }
.text-red    { color: #ef4444; }
.text-yellow { color: #f59e0b; }
.text-purple { color: #8b5cf6; }
.text-cyan   { color: #0ea5e9; }
.text-gray   { color: #64748b; }

/* Padding */
.p-0  { padding: 0; }
.p-3  { padding: 12px; }
.p-4  { padding: 16px; }
.p-5  { padding: 20px; }
.px-3 { padding-left: 12px; padding-right: 12px; }
.py-4 { padding-top: 16px; padding-bottom: 16px; }
.py-6 { padding-top: 24px; padding-bottom: 24px; }

/* Font */
.font-bold   { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-xs  { font-size: 11px; }
.text-sm  { font-size: 12px; }
.text-base { font-size: 13px; }
.text-lg  { font-size: 15px; }
.text-xl  { font-size: 18px; }
.text-2xl { font-size: 22px; }

/* Border radius */
.rounded    { border-radius: var(--radius-sm); }
.rounded-lg { border-radius: var(--radius); }
.rounded-full { border-radius: 9999px; }

/* Display */
.hidden { display: none; }
.block  { display: block; }
.inline-flex { display: inline-flex; }

/* Overflow */
.overflow-x-auto { overflow-x: auto; }
.overflow-hidden  { overflow: hidden; }

/* Cursor */
.cursor-pointer { cursor: pointer; }

/* ─── 페이지 헤더 개선 ──────────────────────────────────────── */
.page-header-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.page-header-icon.blue   { background: #dbeafe; color: #2563eb; }
.page-header-icon.green  { background: #dcfce7; color: #16a34a; }
.page-header-icon.purple { background: #ede9fe; color: #7c3aed; }
.page-header-icon.yellow { background: #fef3c7; color: #d97706; }
.page-header-icon.red    { background: #fee2e2; color: #dc2626; }
.page-header-icon.cyan   { background: #cffafe; color: #0891b2; }
.page-header-icon.orange { background: #ffedd5; color: #ea580c; }
.page-header-icon.pink   { background: #fce7f3; color: #be185d; }

/* ─── stat-card 개선 ────────────────────────────────────────── */
.stat-card-v2 {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  transition: box-shadow 0.2s, transform 0.2s;
}
.stat-card-v2:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-card-v2 .sc-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.stat-card-v2 .sc-body { flex: 1; min-width: 0; }
.stat-card-v2 .sc-label { font-size: 11.5px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.stat-card-v2 .sc-value { font-size: 22px; font-weight: 800; color: var(--text-primary); line-height: 1.1; }
.stat-card-v2 .sc-sub   { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ─── 카드 섹션 헤더 ────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}
.section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.section-title i { color: var(--accent); font-size: 14px; }
.section-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ─── 필터 바 ───────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 12px 16px;
  background: #f8fafc;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

/* ─── 사이드바 사용자 정보 ──────────────────────────────────── */
.sidebar-user {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.sidebar-user .user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.sidebar-user .user-info { flex: 1; min-width: 0; }
.sidebar-user .user-name { font-size: 12.5px; font-weight: 600; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .user-role { font-size: 11px; color: #64748b; margin-top: 1px; }

/* ─── 토글 스위치 ───────────────────────────────────────────── */
.toggle-wrap {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
}
.toggle-input { display: none; }
.toggle-slider {
  width: 36px; height: 20px;
  background: #cbd5e1; border-radius: 10px;
  position: relative; transition: background 0.2s; flex-shrink: 0;
}
.toggle-slider::after {
  content: '';
  position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: #fff; border-radius: 50%;
  transition: left 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-input:checked + .toggle-slider { background: var(--accent); }
.toggle-input:checked + .toggle-slider::after { left: 18px; }

/* ─── 테이블 셀 특수 스타일 ─────────────────────────────────── */
.td-num  { text-align: right; font-variant-numeric: tabular-nums; }
.td-mono { font-family: 'Consolas', monospace; font-size: 12px; }
.td-date { white-space: nowrap; color: var(--text-secondary); }
.td-emp  { font-weight: 600; color: var(--text-primary); }
.td-muted { color: var(--text-muted); font-size: 12px; }

/* ─── 공통 카드 패딩 ────────────────────────────────────────── */
.card-p { padding: 20px; }

/* ─── 그리드 카드 레이아웃 ─────────────────────────────────── */
.stats-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}
.stats-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.stats-grid.cols-5 { grid-template-columns: repeat(5, 1fr); }
.stats-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.stats-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.stats-grid.cols-7 { grid-template-columns: repeat(7, 1fr); }
.stats-grid.cols-9 { grid-template-columns: repeat(9, 1fr); }

@media (max-width: 1100px) {
  .stats-grid.cols-9 { grid-template-columns: repeat(5, 1fr); }
  .stats-grid.cols-7 { grid-template-columns: repeat(4, 1fr); }
  .stats-grid.cols-5 { grid-template-columns: repeat(3, 1fr); }
  .stats-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .stats-grid.cols-9,
  .stats-grid.cols-7,
  .stats-grid.cols-5,
  .stats-grid.cols-4,
  .stats-grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
  .stats-grid.cols-2 { grid-template-columns: 1fr; }
  .grid-4, .grid-3, .grid-2, .grid-2-1 { grid-template-columns: 1fr; gap: 12px; }
}

/* ═══════════════════════════════════════════════════════════
   Tailwind CDN 제거 후 호환 유틸리티 클래스
   ═══════════════════════════════════════════════════════════ */

/* Layout */
.block { display: block; }
.flex { display: flex; }
.grid { display: grid; }
.inline-flex { display: inline-flex; }
.hidden { display: none; }

/* Flex */
.flex-1 { flex: 1 1 0%; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.justify-start { justify-content: flex-start; }

/* Grid */
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.col-span-2 { grid-column: span 2 / span 2; }

/* Gap */
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-5 { gap: 20px; }
.gap-6 { gap: 24px; }

/* Spacing - Padding */
.p-1 { padding: 4px; }
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.p-5 { padding: 20px; }
.p-6 { padding: 24px; }
.px-1 { padding-left: 4px; padding-right: 4px; }
.px-2 { padding-left: 8px; padding-right: 8px; }
.px-3 { padding-left: 12px; padding-right: 12px; }
.px-4 { padding-left: 16px; padding-right: 16px; }
.px-5 { padding-left: 20px; padding-right: 20px; }
.px-6 { padding-left: 24px; padding-right: 24px; }
.py-1 { padding-top: 4px; padding-bottom: 4px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.py-3 { padding-top: 12px; padding-bottom: 12px; }
.py-4 { padding-top: 16px; padding-bottom: 16px; }
.py-5 { padding-top: 20px; padding-bottom: 20px; }
.py-6 { padding-top: 24px; padding-bottom: 24px; }
.py-8 { padding-top: 32px; padding-bottom: 32px; }
.pt-1 { padding-top: 4px; }
.pt-2 { padding-top: 8px; }
.pt-3 { padding-top: 12px; }
.pt-4 { padding-top: 16px; }
.pb-1 { padding-bottom: 4px; }
.pb-2 { padding-bottom: 8px; }
.pb-3 { padding-bottom: 12px; }
.pb-4 { padding-bottom: 16px; }

/* Spacing - Margin */
.m-0 { margin: 0; }
.m-1 { margin: 4px; }
.m-2 { margin: 8px; }
.m-3 { margin: 12px; }
.m-4 { margin: 16px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.mb-6 { margin-bottom: 24px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; }
.mt-6 { margin-top: 24px; }
.ml-1 { margin-left: 4px; }
.ml-2 { margin-left: 8px; }
.ml-3 { margin-left: 12px; }
.ml-4 { margin-left: 16px; }
.mr-1 { margin-right: 4px; }
.mr-2 { margin-right: 8px; }
.mr-3 { margin-right: 12px; }
.mr-4 { margin-right: 16px; }
.mx-auto { margin-left: auto; margin-right: auto; }

/* Width & Height */
.w-full { width: 100%; }
.w-auto { width: auto; }
.h-full { height: 100%; }
.max-w-sm { max-width: 384px; }
.max-w-md { max-width: 448px; }
.max-w-lg { max-width: 512px; }
.max-w-xl { max-width: 576px; }
.max-w-2xl { max-width: 672px; }
.min-w-0 { min-width: 0; }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }

/* Text */
.text-xs { font-size: 11px; line-height: 16px; }
.text-sm { font-size: 12px; line-height: 18px; }
.text-base { font-size: 14px; line-height: 20px; }
.text-lg { font-size: 16px; line-height: 24px; }
.text-xl { font-size: 18px; line-height: 28px; }
.text-2xl { font-size: 22px; line-height: 32px; }
.text-3xl { font-size: 28px; line-height: 36px; }
.text-4xl { font-size: 36px; line-height: 40px; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-white { color: #ffffff; }
.text-gray-300 { color: #d1d5db; }
.text-gray-400 { color: #9ca3af; }
.text-gray-500 { color: #6b7280; }
.text-gray-600 { color: #4b5563; }
.text-gray-700 { color: #374151; }
.text-gray-800 { color: #1f2937; }
.text-blue-300 { color: #93c5fd; }
.text-blue-500 { color: #3b82f6; }
.text-blue-600 { color: #2563eb; }
.text-green-500 { color: #22c55e; }
.text-green-600 { color: #16a34a; }
.text-red-400 { color: #f87171; }
.text-red-500 { color: #ef4444; }
.text-yellow-500 { color: #eab308; }
.text-purple-500 { color: #a855f7; }

/* Font */
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* Border */
.border { border-width: 1px; border-style: solid; border-color: #e5e7eb; }
.border-0 { border-width: 0; }
.border-t { border-top-width: 1px; border-top-style: solid; border-top-color: #e5e7eb; }
.border-b { border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #e5e7eb; }
.border-gray-200 { border-color: #e5e7eb; }
.border-gray-300 { border-color: #d1d5db; }

/* Border Radius */
.rounded { border-radius: 4px; }
.rounded-md { border-radius: 6px; }
.rounded-lg { border-radius: 8px; }
.rounded-xl { border-radius: 12px; }
.rounded-full { border-radius: 9999px; }

/* Background */
.bg-white { background-color: #ffffff; }
.bg-gray-50 { background-color: #f9fafb; }
.bg-gray-100 { background-color: #f3f4f6; }
.bg-gray-200 { background-color: #e5e7eb; }
.bg-blue-50 { background-color: #eff6ff; }
.bg-blue-500 { background-color: #3b82f6; }
.bg-blue-600 { background-color: #2563eb; }
.bg-green-50 { background-color: #f0fdf4; }
.bg-red-50 { background-color: #fef2f2; }

/* Shadow */
.shadow { box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06); }
.shadow-md { box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06); }
.shadow-lg { box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05); }

/* Position */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

/* Cursor */
.cursor-pointer { cursor: pointer; }
.cursor-default { cursor: default; }
.cursor-not-allowed { cursor: not-allowed; }

/* Hover utilities */
.hover\:text-gray-600:hover { color: #4b5563; }
.hover\:underline:hover { text-decoration: underline; }
.hover\:bg-gray-100:hover { background-color: #f3f4f6; }

/* Misc */
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whitespace-nowrap { white-space: nowrap; }
.break-words { word-break: break-word; }
.select-none { user-select: none; }
.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }
.transition { transition-property: color, background-color, border-color, fill, stroke, opacity, box-shadow, transform; transition-duration: 150ms; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border-width: 0; }

/* sm breakpoint responsive */
@media (max-width: 640px) {
  .sm\:col-span-1 { grid-column: span 1; }
}
