/* === CLYVON ERP Theme === */
/* 네이비 다크: #0d1b2a | 네이비 미드: #1b2a40 | 네이비 라이트: #243447 */
/* 골드 메인: #c9a96e | 골드 라이트: #dcc99a | 골드 다크: #a8893f */

/* === 기본 리셋 === */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', -apple-system, sans-serif; background: #f5f5f0; color: #1a1a2e; display: flex; min-height: 100vh; }
a { color: #c9a96e; text-decoration: none; }
button, .btn { cursor: pointer; border: none; border-radius: 6px; padding: 8px 16px; font-size: 14px; transition: all 0.2s; }

/* === 사이드바 === */
.sidebar { width: 240px; background: #0d1b2a; color: #fff; display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; }
.sidebar-header { padding: 16px 16px; border-bottom: 1px solid #243447; display: flex; align-items: center; justify-content: space-between; }
.sidebar-logo { color: #c9a96e; font-size: 16px; font-weight: 700; text-decoration: none; display: flex; align-items: center; gap: 10px; overflow: hidden; }
.sidebar-logo:hover { color: #dcc99a; }
.sidebar-logo img { width: 32px; height: 32px; flex-shrink: 0; }
.sidebar-title { white-space: nowrap; }
.sidebar-toggle { background: none; border: none; color: #fff; font-size: 30px; font-weight: 900; cursor: pointer; padding: 4px 10px; border-radius: 4px; flex-shrink: 0; -webkit-text-stroke: 1px #fff; }
.sidebar-toggle:hover { color: #c9a96e; background: #1b2a40; }

/* 상단 바 (사용자명) — sticky 고정 */
.top-bar { display: flex; justify-content: flex-end; align-items: center; position: sticky; top: 0; z-index: 50; background: #f5f5f0; margin: -24px -24px 0 -24px; padding: 10px 24px; }
.top-bar-right { display: flex; align-items: center; gap: 12px; }
.top-user { font-size: 15px; font-weight: 700; color: #0d1b2a; background: #fff; padding: 10px 20px; border-radius: 24px; box-shadow: 0 2px 6px rgba(0,0,0,0.1); cursor: pointer; }
.top-user:hover { background: #f5f5f0; }

/* 홈 바로가기 */
.sidebar-home { display: flex; align-items: center; gap: 8px; padding: 10px 16px; color: #8899aa; font-size: 13px; font-weight: 600; border-bottom: 1px solid #243447; transition: all 0.2s; text-decoration: none; }
.sidebar-home:hover { background: #1b2a40; color: #dcc99a; }
.sidebar-home.active { background: #1b2a40; color: #fff; }

/* 사이드바 접기 */
body.sidebar-collapsed .sidebar { width: 56px; }
body.sidebar-collapsed .sidebar-title { display: none; }
body.sidebar-collapsed .sidebar-toggle { transform: rotate(180deg); position: absolute; left: 50%; transform: translateX(-50%) rotate(180deg); padding: 4px 6px; }
body.sidebar-collapsed .sidebar-header { justify-content: center; padding: 16px 8px; }
body.sidebar-collapsed .sidebar-logo img { margin: 0 auto; }
body.sidebar-collapsed .sidebar-home-text { display: none; }
body.sidebar-collapsed .sidebar-home { justify-content: center; padding: 10px 0; }
body.sidebar-collapsed .nav-menu .module-name,
body.sidebar-collapsed .nav-menu .module-arrow,
body.sidebar-collapsed .nav-menu .accordion-sub { display: none !important; }
body.sidebar-collapsed .nav-menu .module-toggle { justify-content: center; padding: 12px 0; }
body.sidebar-collapsed .nav-menu .module-icon { font-size: 20px; }
body.sidebar-collapsed .content { margin-left: 56px; }
body.sidebar-collapsed .sidebar-bottom .module-name,
body.sidebar-collapsed .sidebar-bottom .module-arrow,
body.sidebar-collapsed .sidebar-bottom .accordion-sub { display: none !important; }
body.sidebar-collapsed .sidebar-bottom .module-toggle { justify-content: center; padding: 12px 0; }
.sidebar { transition: width 0.25s ease; }
.content { transition: margin-left 0.25s ease; }
.nav-menu { list-style: none; flex: 1; padding: 8px 0; overflow-y: auto; }

/* 직원 개인 섹션 */
.sidebar-personal { border-top: 1px solid #243447; padding: 4px 0; }
.sidebar-divider-label { padding: 8px 16px 4px; font-size: 10px; font-weight: 700; color: #4a6580; text-transform: uppercase; letter-spacing: 1px; cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
.sidebar-divider-label .my-arrow { font-size: 8px; transition: transform 0.2s; }
.sidebar-divider-label .my-arrow.open { transform: rotate(90deg); }
.personal-menu { list-style: none; max-height: 0; overflow: hidden; transition: max-height 0.3s ease; }
.personal-menu.open { max-height: 500px; }
.personal-menu a { display: flex; align-items: center; gap: 8px; padding: 6px 16px 6px 20px; color: #5566a0; font-size: 12px; text-decoration: none; transition: all 0.2s; }
.personal-menu a:hover { color: #dcc99a; background: #162436; }
.personal-menu .my-icon { font-size: 14px; flex-shrink: 0; width: 20px; text-align: center; }
.personal-menu .my-text { white-space: nowrap; }
body.sidebar-collapsed .sidebar-personal .sidebar-divider-label { display: none; }
body.sidebar-collapsed .personal-menu { max-height: 500px !important; }
body.sidebar-collapsed .personal-menu .my-text { display: none; }
body.sidebar-collapsed .personal-menu a { justify-content: center; padding: 10px 0; }

/* 제품CPU 하단 고정 */
.sidebar-bottom { border-top: 1px solid #243447; padding: 4px 0; margin-top: auto; }

/* 모듈 아코디언 (3단) */
.nav-module { border-bottom: 1px solid #243447; }
.sidebar-bottom .nav-module { border-bottom: none; }
.module-icon { font-size: 18px; flex-shrink: 0; }
.module-name { flex: 1; }
.module-arrow { font-size: 10px; transition: transform 0.2s; color: #4a6580; }
.module-arrow.open { transform: rotate(90deg); }

/* 아코디언 공통 */
.accordion-sub { list-style: none; max-height: 0; overflow: hidden; transition: max-height 0.4s ease; }
.accordion-sub.open { max-height: 2000px; }

/* 1단: 모듈 - 순백색 */
.depth-1 { display: flex; align-items: center; gap: 10px; padding: 12px 16px; color: #fff; font-size: 14px; font-weight: 600; transition: all 0.2s; cursor: pointer; text-decoration: none; }
.depth-1:hover { background: #1b2a40; color: #dcc99a; }
.depth-1.active { background: #1b2a40; color: #c9a96e; }

/* 2단: 판매형태 / 공유데이터 */
.sub-toggle { display: flex; align-items: center; justify-content: space-between; cursor: pointer; text-decoration: none; transition: all 0.2s; }
.depth-2 { padding: 8px 16px 8px 32px; color: #7788a0; font-size: 13px; font-weight: 600; }
.depth-2:hover { background: #162436; color: #dcc99a; }
.depth-2.active { color: #fff; }

/* 3단: 사업자 */
.depth-3 { padding: 6px 16px 6px 44px; color: #6677a0; font-size: 12px; font-weight: 500; }
.depth-3:hover { background: #162436; color: #dcc99a; }
.depth-3.active { color: #fff; }

/* 4단: 하위 페이지 */
.depth-4 { display: block; padding: 5px 16px 5px 58px; color: #5566a0; font-size: 12px; transition: all 0.2s; text-decoration: none; }
.depth-4:hover { color: #dcc99a; background: #162436; }
.depth-4.active { color: #fff; background: #1b2a40; border-left: 3px solid #c9a96e; padding-left: 55px; }

/* === 콘텐츠 === */
.content { margin-left: 240px; padding: 24px; flex: 1; min-height: 100vh; }
.content-full { padding: 0; flex: 1; }

/* === 페이지 헤더 (flex 한줄 + sticky) === */
.page-header { margin-bottom: 16px; display: flex; align-items: baseline; gap: 12px; position: sticky; top: 42px; z-index: 40; background: #f5f5f0; padding: 6px 0; }
.page-header h1 { font-size: 28px; font-weight: 700; color: #0d1b2a; white-space: nowrap; }
.page-desc { color: #666; font-size: 13px; }

/* === 카드 === */
.card { background: #fff; border-radius: 10px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); margin-bottom: 16px; }
.dashboard-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { display: flex; align-items: center; gap: 16px; }
.stat-card.warning .stat-value { color: #e74c3c; }
.stat-icon { font-size: 32px; }
.stat-value { font-size: 28px; font-weight: 700; display: block; color: #0d1b2a; }
.stat-label { font-size: 13px; color: #666; }
.stat-change { font-size: 11px; margin-top: 2px; }
.stat-change.up { color: #27ae60; }
.stat-change.down { color: #e74c3c; }
.dashboard-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* === 버튼 === */
.btn-primary { background: #c9a96e; color: #fff; }
.btn-primary:hover { background: #a8893f; }
.btn-secondary { background: #e9ecef; color: #333; }
.btn-secondary:hover { background: #dee2e6; }
.btn-outline { background: transparent; border: 1px solid #c9a96e; color: #c9a96e; }
.btn-outline:hover { background: #c9a96e; color: #fff; }
.btn-danger { background: #e74c3c; color: #fff; }
.btn-danger:hover { background: #c0392b; }
.btn-success { background: #27ae60; color: #fff; }
.btn-success:hover { background: #219a52; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-full { width: 100%; padding: 12px; font-size: 16px; }

/* === 폼 === */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; color: #333; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px;
}
.form-group input:focus, .form-group select:focus { outline: none; border-color: #c9a96e; box-shadow: 0 0 0 3px rgba(201,169,110,0.15); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.form-inline { display: flex; gap: 8px; align-items: end; }

/* === 로그인 === */
.login-container { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: linear-gradient(135deg, #0d1b2a, #1b2a40); }
.login-box { background: #fff; padding: 40px; border-radius: 12px; width: 400px; box-shadow: 0 10px 30px rgba(0,0,0,0.3); }
.login-box h1 { text-align: center; margin-bottom: 8px; font-size: 22px; color: #0d1b2a; }
.login-logo { display: block; margin: 0 auto 16px; width: 100px; }
.login-subtitle { text-align: center; color: #666; margin-bottom: 24px; font-size: 14px; }
.login-hint { text-align: center; color: #999; font-size: 12px; margin-top: 16px; }

/* === 테이블 === */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th { background: #f8f9fa; padding: 10px 8px; text-align: left; font-weight: 600; border-bottom: 2px solid #dee2e6; position: sticky; top: 0; white-space: nowrap; z-index: 5; }
tbody td { padding: 8px; border-bottom: 1px solid #eee; vertical-align: middle; }
tbody tr:hover { background: #faf8f4; }
tbody tr.selected { background: #f5edd8; }
tbody tr.group-header { background: #fff3cd; font-weight: 600; }
td input[type="number"], td input[type="text"], td input[type="date"], td select {
    padding: 4px 6px; border: 1px solid #ddd; border-radius: 4px; font-size: 13px; width: 100%;
}
td input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; }

/* === 알림 === */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #ffeaea; color: #c0392b; border: 1px solid #f5c6cb; }
.alert-success { background: #eafff0; color: #27ae60; border: 1px solid #c3e6cb; }

/* === 토스트 === */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; }
.toast { background: #0d1b2a; color: #fff; padding: 12px 20px; border-radius: 8px; margin-bottom: 8px; font-size: 14px; animation: slideIn 0.3s ease; min-width: 250px; }
.toast.success { background: #27ae60; }
.toast.error { background: #e74c3c; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* === 탭 === */
.tabs { display: flex; gap: 0; border-bottom: 2px solid #eee; margin-bottom: 20px; }
.tab { padding: 10px 20px; font-size: 14px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; color: #666; background: none; }
.tab.active { color: #c9a96e; border-bottom-color: #c9a96e; font-weight: 600; }

/* === 모달 === */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 1000; display: flex; justify-content: center; align-items: center; }
.modal { background: #fff; border-radius: 12px; padding: 24px; width: 500px; max-width: 90vw; max-height: 80vh; overflow-y: auto; }
.modal h2 { margin-bottom: 16px; font-size: 18px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

/* === 그룹 표시 === */
.group-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.group-badge.g1 { background: #e8f5e9; color: #2e7d32; }
.group-badge.g2 { background: #e3f2fd; color: #1565c0; }
.group-badge.g3 { background: #fff3e0; color: #e65100; }
.group-badge.g4 { background: #fce4ec; color: #c62828; }

/* === 도구바 === */
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar-right { margin-left: auto; display: flex; gap: 8px; }

/* === 빈 상태 === */
.empty-state { text-align: center; padding: 60px 20px; color: #999; }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }

/* === 유틸리티 === */
.text-muted { color: #999; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }

/* === 허브 그리드 === */
.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.hub-card { display: flex; align-items: center; gap: 16px; background: #fff; border-radius: 12px; padding: 20px 24px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); transition: all 0.2s; text-decoration: none; color: inherit; }
.hub-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.12); }
.hub-icon { width: 52px; height: 52px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 24px; color: #fff; flex-shrink: 0; }
.hub-info h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px; color: #0d1b2a; }
.hub-info p { font-size: 13px; color: #888; line-height: 1.4; }
.hub-badge { display: inline-block; background: #f0f0f0; color: #999; font-size: 11px; padding: 2px 8px; border-radius: 10px; margin-top: 4px; }

/* === 대시보드 전용 === */
.dash-stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.dash-stat { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.dash-stat .ds-icon { font-size: 28px; margin-bottom: 8px; }
.dash-stat .ds-value { font-size: 24px; font-weight: 700; color: #0d1b2a; }
.dash-stat .ds-label { font-size: 12px; color: #888; margin-top: 4px; }
.dash-stat .ds-change { font-size: 11px; margin-top: 4px; }
.dash-stat .ds-change.up { color: #27ae60; }
.dash-stat .ds-change.down { color: #e74c3c; }

.seller-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 12px; }
.seller-table th { background: #f8f9fa; padding: 10px 12px; text-align: right; font-weight: 600; border-bottom: 2px solid #dee2e6; }
.seller-table th:first-child { text-align: left; }
.seller-table td { padding: 10px 12px; border-bottom: 1px solid #eee; text-align: right; }
.seller-table td:first-child { text-align: left; font-weight: 600; }
.seller-table tr.total-row { background: #faf7f0; }
.seller-table tr.total-row td { font-weight: 700; color: #c9a96e; border-top: 2px solid #c9a96e; }

.progress-bar-wrap { background: #eee; border-radius: 20px; height: 24px; overflow: hidden; display: flex; margin: 8px 0; }
.progress-fill { height: 100%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: #fff; }
.progress-fill.done { background: #27ae60; }
.progress-fill.wait { background: #f39c12; }

.dash-shortcut-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
.dash-shortcut { display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: #f8f9fa; border-radius: 8px; text-decoration: none; color: #333; transition: all 0.15s; }
.dash-shortcut:hover { background: #f0ede5; transform: translateY(-1px); }
.dash-shortcut .sc-icon { font-size: 22px; }
.dash-shortcut .sc-name { font-size: 13px; font-weight: 600; }

.mini-chart { display: flex; align-items: flex-end; gap: 3px; height: 60px; margin-top: 12px; }
.mini-bar { flex: 1; background: #c9a96e; border-radius: 2px 2px 0 0; min-height: 4px; position: relative; }
.mini-bar-label { position: absolute; top: -14px; left: 50%; transform: translateX(-50%); font-size: 9px; color: #888; white-space: nowrap; }

/* === 인쇄 === */
@media print {
    .sidebar, .toolbar, .btn, .no-print { display: none !important; }
    .content { margin-left: 0; padding: 0; }
    table { font-size: 11px; }
}
