/* ── 기본 리셋 & 변수 ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #1d4ed8;
  --primary-dark: #1e3a8a;
  --primary-light: #dbeafe;
  --primary-mid: #3b82f6;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --sidebar-w: 240px;
  --topbar-h: 56px;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.1);
  --shadow-md: 0 4px 12px rgba(0,0,0,.12);
}

body { font-family: 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif; font-size: 14px; color: var(--gray-800); line-height: 1.6; }

/* ── 관리자 로그인 ───────────────────────────────────────────────────────── */
.admin-login-body { background: linear-gradient(135deg, #1d4ed8 0%, #1e3a8a 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.admin-login-wrap { width: 100%; max-width: 400px; padding: 20px; }
.admin-login-box { background: #fff; border-radius: 16px; padding: 40px 36px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.admin-logo { text-align: center; margin-bottom: 32px; }
.logo-text { font-size: 28px; font-weight: 800; color: var(--primary); display: block; letter-spacing: -0.5px; }
.logo-sub { font-size: 13px; color: var(--gray-400); font-weight: 500; }

.intGroup { margin-bottom: 14px; }
input[type="text"], input[type="password"], input[type="email"], input[type="tel"], input[type="number"], select, textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--gray-300);
  border-radius: var(--radius); font-size: 14px; color: var(--gray-800);
  background: #fff; transition: border-color .2s, box-shadow .2s; -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29,78,216,.12); }
input::placeholder, textarea::placeholder { color: var(--gray-400); }

.btn_global { padding: 13px 24px; border: none; border-radius: var(--radius); font-size: 15px; font-weight: 700; cursor: pointer; transition: all .2s; }
.bblue { background: var(--primary); color: #fff; }
.bblue:hover { background: var(--primary-dark); }
.w100 { width: 100%; }
.errorMsg { font-size: 12px; color: var(--danger); margin-top: 6px; }

/* ── ERP 레이아웃 ────────────────────────────────────────────────────────── */
.admin-body { background: var(--gray-50); min-height: 100vh; display: flex; }

/* 사이드바 */
.sidebar {
  width: var(--sidebar-w); background: var(--primary-dark); color: #fff;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 200;
  display: flex; flex-direction: column; transition: transform .3s;
}
.sidebar-logo { padding: 20px 20px 16px; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar-logo .logo-text { font-size: 20px; font-weight: 800; color: #fff; display: block; }
.sidebar-logo .logo-sub { font-size: 11px; color: rgba(255,255,255,.5); }

.sidebar-menu { flex: 1; padding: 12px 0; overflow-y: auto; }
.sidebar-menu li { list-style: none; }
.menu-item {
  display: flex; align-items: center; gap: 10px; padding: 12px 20px;
  color: rgba(255,255,255,.7); text-decoration: none; font-size: 14px;
  font-weight: 500; transition: all .2s; cursor: pointer;
}
.menu-item:hover { background: rgba(255,255,255,.1); color: #fff; }
.menu-item.active { background: rgba(255,255,255,.15); color: #fff; font-weight: 700; border-right: 3px solid #fff; }
.menu-item i { width: 18px; text-align: center; }

.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.1); }
.admin-info-box { font-size: 12px; color: rgba(255,255,255,.6); margin-bottom: 10px; }
.admin-info-box strong { color: #fff; font-size: 13px; display: block; margin-bottom: 2px; }
.logout-btn-side { width: 100%; padding: 9px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2); color: rgba(255,255,255,.8); border-radius: var(--radius); cursor: pointer; font-size: 13px; transition: all .2s; display: flex; align-items: center; justify-content: center; gap: 6px; }
.logout-btn-side:hover { background: rgba(255,255,255,.2); color: #fff; }

/* 메인 콘텐츠 */
.main-content { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

.top-bar { height: var(--topbar-h); background: #fff; border-bottom: 1px solid var(--gray-200); display: flex; align-items: center; padding: 0 24px; gap: 16px; position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow); }
.sidebar-toggle { background: none; border: none; font-size: 18px; color: var(--gray-500); cursor: pointer; padding: 6px; display: none; }
.page-title { font-size: 18px; font-weight: 700; color: var(--gray-800); }

.content-area { flex: 1; padding: 24px; }

/* ── 대시보드 ────────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: 12px; padding: 20px; box-shadow: var(--shadow); border-left: 4px solid var(--gray-200); transition: transform .2s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card.total { border-left-color: var(--primary); }
.stat-card.pending { border-left-color: var(--gray-400); }
.stat-card.review1 { border-left-color: var(--primary-mid); }
.stat-card.review2 { border-left-color: var(--warning); }
.stat-card.approved { border-left-color: var(--success); }
.stat-card.rejected { border-left-color: var(--danger); }
.stat-label { font-size: 12px; color: var(--gray-400); font-weight: 500; margin-bottom: 6px; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--gray-800); }

/* ── 카드 ────────────────────────────────────────────────────────────────── */
.card { background: #fff; border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; margin-bottom: 20px; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--gray-100); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 15px; font-weight: 700; color: var(--gray-800); }
.card-body { padding: 20px; }

/* ── 테이블 ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { background: var(--gray-50); padding: 10px 12px; text-align: left; font-weight: 600; color: var(--gray-600); border-bottom: 1px solid var(--gray-200); white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid var(--gray-100); color: var(--gray-700); vertical-align: middle; }
tr:hover td { background: var(--gray-50); }
tr:last-child td { border-bottom: none; }

/* ── 상태 배지 ───────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-pending { background: var(--gray-100); color: var(--gray-500); }
.badge-review1 { background: #dbeafe; color: #1d4ed8; }
.badge-review2 { background: #fef3c7; color: #d97706; }
.badge-approved { background: #d1fae5; color: #059669; }
.badge-rejected { background: #fee2e2; color: #dc2626; }

/* ── 필터/검색 영역 ──────────────────────────────────────────────────────── */
.filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-bar input, .filter-bar select { padding: 8px 12px; border: 1px solid var(--gray-300); border-radius: var(--radius); font-size: 13px; min-width: 140px; }
.filter-bar input { flex: 1; min-width: 200px; }
.btn-sm { padding: 8px 14px; font-size: 13px; font-weight: 600; border: none; border-radius: var(--radius); cursor: pointer; transition: all .2s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-secondary { background: var(--gray-100); color: var(--gray-600); border: 1px solid var(--gray-200); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: var(--primary-light); }

/* ── 페이지네이션 ────────────────────────────────────────────────────────── */
.pagination { display: flex; justify-content: center; gap: 4px; margin-top: 16px; }
.page-btn { padding: 6px 12px; border: 1px solid var(--gray-200); border-radius: var(--radius); background: #fff; cursor: pointer; font-size: 13px; color: var(--gray-600); transition: all .2s; }
.page-btn:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-btn:disabled { opacity: .4; cursor: default; }

/* ── 모달 ────────────────────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 1000; }
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-wrapper { width: 100%; max-width: 560px; }
.modal-container { background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.2); max-height: 90vh; display: flex; flex-direction: column; }
.modal-container.modal-xl { max-width: 860px; }
.modal-container.modal-sm { max-width: 400px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--gray-200); flex-shrink: 0; }
.modal-title { font-size: 16px; font-weight: 700; color: var(--gray-800); }
.modal-close { background: none; border: none; font-size: 18px; color: var(--gray-400); cursor: pointer; padding: 4px; line-height: 1; }
.modal-close:hover { color: var(--gray-700); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--gray-200); display: flex; gap: 8px; justify-content: flex-end; flex-shrink: 0; }

/* ── 회원 상세 ───────────────────────────────────────────────────────────── */
.detail-section { margin-bottom: 20px; }
.detail-section-title { font-size: 13px; font-weight: 700; color: var(--primary); margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--primary-light); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.detail-item { }
.detail-label { font-size: 11px; color: var(--gray-400); font-weight: 600; margin-bottom: 2px; }
.detail-value { font-size: 13px; color: var(--gray-800); word-break: break-all; }

/* 상태 변경 섹션 */
.status-change-wrap { background: var(--gray-50); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.status-change-wrap label { font-size: 13px; font-weight: 600; color: var(--gray-700); display: block; margin-bottom: 8px; }
.status-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.status-btn { padding: 7px 14px; border-radius: var(--radius); border: 2px solid transparent; cursor: pointer; font-size: 12px; font-weight: 600; transition: all .2s; }
.status-btn[data-status="PENDING"] { background: var(--gray-100); color: var(--gray-500); border-color: var(--gray-300); }
.status-btn[data-status="REVIEW1"] { background: #dbeafe; color: #1d4ed8; border-color: #93c5fd; }
.status-btn[data-status="REVIEW2"] { background: #fef3c7; color: #d97706; border-color: #fde68a; }
.status-btn[data-status="APPROVED"] { background: #d1fae5; color: #059669; border-color: #6ee7b7; }
.status-btn[data-status="REJECTED"] { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }
.status-btn.selected, .status-btn:hover { transform: scale(1.05); box-shadow: var(--shadow-md); }

/* 파일 보기 */
.file-links { display: flex; flex-direction: column; gap: 8px; }
.file-link-item { display: flex; align-items: center; gap: 8px; }
.file-link-btn { padding: 6px 14px; background: var(--primary-light); color: var(--primary); border: 1px solid var(--primary); border-radius: var(--radius); cursor: pointer; font-size: 12px; font-weight: 600; transition: all .2s; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.file-link-btn:hover { background: var(--primary); color: #fff; }
.file-link-label { font-size: 13px; color: var(--gray-600); }

/* 이력 타임라인 */
.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 0; bottom: 0; width: 2px; background: var(--gray-200); }
.timeline-item { position: relative; margin-bottom: 14px; }
.timeline-item::before { content: ''; position: absolute; left: -17px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--primary); }
.timeline-time { font-size: 11px; color: var(--gray-400); margin-bottom: 2px; }
.timeline-content { font-size: 13px; color: var(--gray-700); }
.timeline-status { display: inline-flex; gap: 6px; align-items: center; }
.timeline-arrow { color: var(--gray-400); }

/* ── 폼 그룹 (ERP) ───────────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--gray-600); margin-bottom: 5px; }
.form-group input, .form-group select, .form-group textarea { width: 100%; }
.form-group textarea { min-height: 80px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── 토글 스위치 ─────────────────────────────────────────────────────────── */
.toggle-wrap { display: flex; align-items: center; gap: 8px; }
.toggle { position: relative; width: 42px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: var(--gray-300); border-radius: 24px; transition: .3s; }
.toggle-slider::before { content: ''; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .3s; }
.toggle input:checked + .toggle-slider { background: var(--success); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }
.toggle-label { font-size: 13px; color: var(--gray-600); }

/* ── 빈 상태 ─────────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--gray-400); }
.empty-state i { font-size: 48px; margin-bottom: 12px; opacity: .4; }
.empty-state p { font-size: 14px; }

/* ── 로딩 ────────────────────────────────────────────────────────────────── */
.loading { text-align: center; padding: 40px; color: var(--gray-400); font-size: 14px; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--gray-200); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 알림 토스트 ─────────────────────────────────────────────────────────── */
#toast { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast-item { padding: 12px 18px; border-radius: var(--radius); color: #fff; font-size: 13px; font-weight: 600; box-shadow: var(--shadow-md); animation: slideIn .3s ease; }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── 반응형 ──────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .sidebar-toggle { display: block; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
