/* ===== Reset & Base ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --sidebar-w: 270px;
  --primary: #1d4ed8;
  --primary-dark: #1e40af;
  --primary-light: #dbeafe;
  --bg: #eef2f7;
  --card-bg: #ffffff;
  --text: #0f172a;
  --text-light: #475569;
  --border: #cbd5e1;
  --sidebar-bg: #c7d2e0;
  --sidebar-text: #334155;
  --sidebar-active: #1d4ed8;
  --notice: #d97706;
  --update: #059669;
  --radius: 10px;
  --shadow: 0 2px 6px rgba(0,0,0,0.1), 0 1px 3px rgba(0,0,0,0.06);
  --accent-gradient: linear-gradient(135deg, #1e3a5f 0%, #2d1b69 100%);
}

html, body {
  font-family: 'Segoe UI', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100%;
}

/* ===== Sidebar ===== */
#sidebar {
  position: fixed;
  left: 0; top: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s ease;
  overflow-y: auto;
  border-right: 1px solid var(--border);
}

.sidebar-header {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: linear-gradient(135deg, #0f2847 0%, #1a1145 100%);
  color: #fff;
}

.sidebar-dept {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  margin-bottom: 2px;
  letter-spacing: 0.5px;
  font-weight: 500;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-logo img {
  height: 35px;
  width: auto;
}

.sidebar-header h2 {
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  line-height: 1;
  margin: 0;
  padding: 0;
}

.sidebar-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  margin-top: 4px;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.nav-menu {
  list-style: none;
  padding: 8px 0;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  padding: 9px 16px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.15s;
  border-left: 3px solid transparent;
  white-space: nowrap;
  color: #334155;
  font-weight: 500;
}

.nav-item:hover {
  background: #bfcde0;
  color: var(--primary);
}

.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
  border-left-color: var(--sidebar-active);
  font-weight: 700;
}

.nav-icon { font-size: 15px; width: 20px; text-align: center; }

/* ===== Accordion (스킬리스트) ===== */
.nav-group { list-style: none; }

.nav-accordion {
  position: relative;
  -webkit-user-select: none;
  user-select: none;
}

.accordion-arrow {
  position: absolute;
  right: 16px;
  font-size: 12px;
  transition: transform 0.2s;
  color: #94a3b8;
}

.nav-accordion.open .accordion-arrow {
  transform: rotate(90deg);
}

.nav-sub {
  list-style: none;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background: #e2e8f0;
}

.nav-sub.open {
  max-height: 2000px;
}

.nav-sub-group {
  list-style: none;
}

.nav-sub-header {
  padding: 8px 20px 4px 28px;
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  -webkit-user-select: none;
  user-select: none;
}

.nav-sub-header:hover { color: #1e293b; }

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

.nav-sub-items {
  list-style: none;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
}

.nav-sub-items.open { max-height: 1000px; }

.nav-sub-item {
  padding: 4px 16px 4px 36px;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-sub-item:hover {
  color: var(--primary);
  background: #bfdbfe;
}

.nav-sub-item.active {
  color: #1e40af;
  background: #93c5fd;
  font-weight: 700;
}

.sidebar-db {
  padding: 10px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.erp-db-info {
  width: 100%;
  font-size: 10px;
  color: #64748b;
  line-height: 1.6;
}
.erp-db-info span { color: #334155; font-weight: 600; }
.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: #94a3b8;
  flex-shrink: 0;
}

.sidebar-footer .version { margin-top: 2px; font-size: 10px; }

/* ===== Mobile Toggle ===== */
#menu-toggle {
  display: none;
  position: fixed;
  top: 12px; left: 12px;
  z-index: 200;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 40px; height: 40px;
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--shadow);
}

/* ===== Main Content ===== */
#content {
  margin-left: var(--sidebar-w);
  padding: 8px 10px;
  min-height: 100vh;
}

.page { display: none; }
.page.active { display: block; }

h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text);
}

h2 {
  font-size: 17px;
  font-weight: 600;
  margin: 24px 0 14px;
  color: var(--text);
}

/* ===== Home Split Layout ===== */
.home-split {
  display: flex;
  gap: 0;
  height: calc(100vh - 20px);
  margin: -8px -10px;
}

.home-left {
  width: 340px;
  min-width: 340px;
  flex-shrink: 0;
  padding: 24px 20px;
  border-right: 2px solid var(--border);
  overflow-y: auto;
  background: #f1f5f9;
}

.home-left h2 {
  font-size: 18px;
  margin: 0 0 16px;
}

.home-left h3 {
  font-size: 15px;
  margin: 20px 0 12px;
  color: var(--text);
}

.home-right {
  flex: 1;
  padding: 24px 28px;
  overflow-y: auto;
  min-width: 0;
}

.home-right h2 {
  font-size: 18px;
  margin: 0 0 16px;
}

.home-right-split {
  display: flex;
  gap: 20px;
  min-height: 0;
  align-items: flex-start;
}

.home-right-main {
  flex: 1;
  min-width: 0;
}

.home-right-side {
  flex: 1;
  min-width: 0;
}


/* ===== Stats Cards ===== */
.stats-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.stat-card {
  background: linear-gradient(135deg, #1d4ed8 0%, #7c3aed 100%);
  border-radius: 8px;
  padding: 8px 12px;
  text-align: center;
  box-shadow: var(--shadow);
  border: none;
  flex: 1;
}

.stat-number {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.stat-label {
  font-size: 10px;
  color: rgba(255,255,255,0.8);
  margin-top: 2px;
}

/* ===== Pipeline (스킬 사용법) ===== */
.pipeline-container {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
  color: var(--text);
  box-shadow: var(--shadow);
  max-width: 480px;
}

.pipeline-container h3 {
  font-size: 15px;
  margin-bottom: 12px;
  color: var(--text);
  font-weight: 700;
}

.pipeline-flow {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pipeline-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 2px solid;
  transition: transform 0.15s;
  cursor: default;
  font-size: 13px;
}

.pipeline-step:hover {
  transform: translateX(4px);
}

.pipeline-step .step-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.pipeline-step .step-name {
  font-weight: 600;
  font-size: 14px;
  flex: 1;
}

.pipeline-step .step-io {
  font-size: 11px;
  color: #94a3b8;
  text-align: right;
}

.pipeline-arrow {
  text-align: center;
  font-size: 16px;
  color: #94a3b8;
  line-height: 1;
}

.pipeline-split {
  display: flex;
  gap: 10px;
}

.pipeline-split .pipeline-step { flex: 1; }

/* 보조 스킬 섹션 */
.support-skills {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  max-width: 480px;
}

.support-skills h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

.support-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 8px;
  border: 1px solid;
  transition: transform 0.15s;
}

.support-card:last-child { margin-bottom: 0; }

.support-card .sup-id {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.support-card .sup-body {
  flex: 1;
  min-width: 0;
}

.support-card .sup-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.support-card .sup-ver {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  background: #f1f5f9;
  color: #64748b;
  margin-left: 6px;
  font-weight: 600;
}

.support-card .sup-desc {
  font-size: 12px;
  color: #64748b;
  line-height: 1.5;
  margin-top: 2px;
}

.support-card .sup-link {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 2px;
}

/* ===== Workflow Diagram ===== */
.wf-container {
  max-width: 100%;
}

.wf-container h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
}

.wf-node {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 2px solid;
  margin-bottom: 2px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.wf-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  color: #fff;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 1px;
}

.wf-body { flex: 1; min-width: 0; }

.wf-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.wf-ver {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  background: #f1f5f9;
  color: #64748b;
  font-weight: 600;
  margin-left: 4px;
}

.wf-desc {
  font-size: 12px;
  color: #475569;
  line-height: 1.5;
}

.wf-detail {
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.4;
  margin-top: 2px;
}

.wf-return {
  font-size: 11px;
  color: #7c3aed;
  font-weight: 600;
  margin-top: 4px;
}

.wf-arrow {
  text-align: center;
  font-size: 12px;
  color: #94a3b8;
  padding: 3px 0;
  font-weight: 600;
}

.wf-gate {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: #ea580c;
  padding: 4px 0;
  letter-spacing: 0.3px;
}

/* 분기 (09-06) */
.wf-branch {
  margin-left: 24px;
  padding-left: 16px;
  border-left: 2px dashed #e9d5ff;
  position: relative;
  margin-bottom: 2px;
}

.wf-branch::before {
  content: '↳';
  position: absolute;
  left: -9px;
  top: 8px;
  font-size: 14px;
  color: #7c3aed;
  background: #fff;
}

/* 자동 참조 (09-04) */
.wf-auto {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 6px;
  background: #faf5ff;
  border: 1px dashed #e9d5ff;
  margin-bottom: 2px;
}

.wf-auto-text {
  font-size: 12px;
  color: #7c3aed;
  font-weight: 500;
}

/* 병렬 (FMEA / CP) */
.wf-parallel {
  display: flex;
  gap: 10px;
}

.wf-parallel-col {
  flex: 1;
  min-width: 0;
}

.wf-col-label {
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 4px;
  letter-spacing: 0.3px;
}

/* 메인 + 보조(Excel) 가로 배치 */
.wf-with-sub {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.wf-with-sub .wf-main-col {
  flex: 1;
  min-width: 0;
}

.wf-with-sub .wf-sub-col {
  width: 200px;
  flex-shrink: 0;
}

.wf-with-sub .wf-sub-col .wf-node {
  border-style: dashed;
  opacity: 0.7;
  height: 100%;
}

.wf-with-sub .wf-sub-col .wf-desc {
  font-size: 11px;
}

.wf-with-sub .wf-sub-col .wf-badge {
  font-size: 10px;
  padding: 1px 6px;
}

.wf-with-sub .wf-sub-col .wf-name {
  font-size: 12px;
}

/* 별도 스킬 섹션 */
.wf-separate {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  max-width: 100%;
  margin-bottom: 20px;
}

.wf-separate h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.wf-sep-desc {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 12px;
  line-height: 1.5;
}

/* 레거시 파이프라인 */
.legacy-container {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
  color: var(--text);
  box-shadow: var(--shadow);
  max-width: 480px;
}

.legacy-container h3 {
  font-size: 16px;
  margin-bottom: 16px;
  color: var(--text);
  font-weight: 700;
}

.mode-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.mode-card {
  padding: 14px;
  border-radius: 8px;
  border: 2px solid;
}

.mode-card h4 { font-size: 14px; margin-bottom: 6px; }
.mode-card p { font-size: 12px; color: #64748b; line-height: 1.5; }

/* 주의사항 */
.notes-box {
  background: #fef3c7;
  border-left: 4px solid #d97706;
  padding: 16px 20px;
  border-radius: 0 8px 8px 0;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.notes-box h3 {
  font-size: 14px;
  color: #92400e;
  margin-bottom: 8px;
}

.notes-box ul {
  list-style: none;
  padding: 0;
}

.notes-box li {
  font-size: 13px;
  color: #78350f;
  padding: 4px 0;
  line-height: 1.6;
}

.notes-box li::before {
  content: '⚠️ ';
}

/* 스킬 매칭 테이블 */
.matching-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 12px;
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.matching-table th {
  background: #f1f5f9;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
}

.matching-table td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
}

.matching-table tr:hover { background: #f8fafc; }

/* ===== Skill Detail ===== */
.skill-detail {
  max-width: 800px;
}

.skill-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.skill-detail-header .detail-id {
  font-size: 14px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 6px;
  color: #fff;
}

.skill-detail-header h1 {
  margin-bottom: 0;
}

.detail-version {
  font-size: 12px;
  background: #e0f2fe;
  color: #0369a1;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.detail-meta {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.detail-meta-item {
  font-size: 12px;
  color: var(--text-light);
}

.detail-meta-item strong {
  color: var(--text);
}

.detail-section {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.detail-section h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text);
}

.detail-section p {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-light);
}

.detail-section ul {
  list-style: none;
  padding: 0;
}

.detail-section li {
  font-size: 13px;
  padding: 4px 0;
  color: var(--text);
  line-height: 1.5;
}

.detail-section li::before {
  content: '▸ ';
  color: var(--primary);
  font-weight: 700;
}

.trigger-box {
  background: #f0fdf4;
  border-left: 3px solid #22c55e;
  padding: 12px 14px;
  border-radius: 0 8px 8px 0;
  font-size: 13px;
  color: #166534;
  line-height: 1.6;
}

.tier-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 10px;
  font-weight: 600;
}

.tier-1 { background: #fee2e2; color: #991b1b; }
.tier-2 { background: #fef3c7; color: #92400e; }
.tier-3 { background: #e0e7ff; color: #3730a3; }

/* ===== ERP 분석 페이지 ===== */
.erp-page { max-width: 100%; height: 100%; overflow: hidden; }

/* 고정 영역 */
.erp-sticky {
  position: sticky;
  top: 0;
  z-index: 10;
  margin: -8px -10px 4px;
}

/* 필터 1줄 */
.erp-filter-row {
  display: flex;
  align-items: center;
  gap: 0;
  background: #1e293b;
  padding: 6px 10px;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.erp-filter-group {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
  padding: 0 8px;
}
.erp-fg-year { flex-shrink: 0; }
.erp-fg-factory { flex-shrink: 0; }
.erp-fg-product { flex: 1; min-width: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.erp-fg-product::-webkit-scrollbar { display: none; }
.erp-group-arrow {
  flex-shrink: 0;
  background: #334155;
  border: 1px solid #475569;
  border-radius: 4px;
  color: #cbd5e1;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
}
.erp-group-arrow:hover { background: #475569; color: #fff; }
.erp-tab-arrow {
  flex-shrink: 0;
  background: #e2e8f0;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: #475569;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}
.erp-tab-arrow:hover { background: #cbd5e1; color: #1e293b; }
.erp-filter-sep {
  width: 1px; height: 24px; background: #475569; flex-shrink: 0; margin: 0 4px;
}
.erp-filter-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
  padding-left: 8px;
}
/* 기준정보 (탭 행 우측, 같은 줄) */
.erp-info-period {
  width: 30%;
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  white-space: nowrap;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
}
.erp-info-sep {
  width: 1px;
  height: 18px;
  background: #cbd5e1;
  margin: 0 10px;
  flex-shrink: 0;
}
.erp-info-cond {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  white-space: nowrap;
  flex-shrink: 0;
}
/* 다크바 위 토글 버튼 스타일 오버라이드 */
.erp-filter-row .ef-toggle {
  padding: 4px 12px;
  border: 1px solid #475569;
  background: transparent;
  color: #94a3b8;
  font-size: 12px;
}
.erp-filter-row .ef-toggle:hover {
  background: #334155;
  border-color: #64748b;
  color: #e2e8f0;
}
.erp-filter-row .ef-toggle.active {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
  box-shadow: 0 2px 6px rgba(59,130,246,0.3);
}
.erp-filter-row .ef-toggle.ef-disabled {
  opacity: 0.2;
}
.erp-filter-row .ef-toggle-label {
  color: #64748b;
  font-size: 10px;
}

/* 탭 바 */
.erp-tab-bar {
  display: flex;
  align-items: center;
  padding: 0 4px 4px;
}
.erp-tab-nav {
  display: flex;
  align-items: center;
  width: 70%;
  min-width: 0;
  overflow: hidden;
}
.erp-tab-left {
  display: flex;
  gap: 2px;
  flex: 1;
  overflow-x: auto;
  min-width: 0;
  scrollbar-width: none;
}
.erp-tab-left::-webkit-scrollbar { display: none; }
.erp-tab-left .erp-tab-btn {
  flex: 0 0 auto;
  text-align: center;
  white-space: nowrap;
}

.erp-tab-btn {
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: 6px 6px 0 0;
  background: #e2e8f0;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s;
  border-bottom: none;
}

.erp-tab-btn:hover {
  background: #f1f5f9;
  color: var(--text);
}

.erp-tab-btn.active {
  background: #fff;
  color: var(--primary);
  border-color: var(--border);
  border-bottom: 2px solid #fff;
  margin-bottom: -1px;
  position: relative;
  z-index: 1;
}

.erp-tab-content {
  display: none !important;
}

.erp-tab-content.active {
  display: flex !important;
}

.erp-tab-content.active[data-tab="team"],
.erp-tab-content.active[data-tab="quality"],
.erp-tab-content.active[data-tab="hours"],
.erp-tab-content.active[data-tab="equip"],
.erp-tab-content.active[data-tab="production"],
.erp-tab-content.active[data-tab="ref"] {
  display: block !important;
}
/* 도면정보 패널 (중간영역 하단 30%) */
.erp-drawing-panel {
  flex: 3;
  min-height: 0;
  border-top: 2px solid var(--primary);
  background: #fff;
  display: flex;
  flex-direction: column;
}
.erp-drawing-panel > label {
  display: block;
  padding: 5px 10px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: #1e40af;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}
.erp-drawing-body {
  flex: 1;
  overflow: auto;
  font-size: 10px;
}
.erp-drawing-body table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.erp-drawing-body th { background: #f8fafc; padding: 3px 4px; font-weight: 700; font-size: 9px; border-bottom: 2px solid #e2e8f0; position: sticky; top: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.erp-drawing-body td { padding: 2px 4px; border-bottom: 1px solid #f1f5f9; font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.erp-drawing-body td:hover { overflow: visible; white-space: normal; word-break: break-all; background: #fefce8; position: relative; z-index: 5; }
.erp-drawing-body .r { text-align: right; }
.erp-drawing-body col.dw-spec { width: 18%; }
.erp-drawing-body col.dw-name { width: 22%; }
.erp-drawing-body col.dw-od { width: 7%; }
.erp-drawing-body col.dw-len { width: 7%; }
.erp-drawing-body col.dw-mat { width: 18%; }
.erp-drawing-body col.dw-ht { width: 12%; }
.erp-drawing-body col.dw-cust { width: 16%; }

/* 제품/도면 Ref 탭 — flex 강제 */
.erp-tab-content.active.erp-ref-wrap,
.erp-tab-content.active.erp-dv-wrap {
  display: flex !important;
  gap: 0;
  height: calc(100vh - 105px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: #fff;
}
.erp-ref-left {
  width: 180px;
  min-width: 180px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.erp-ref-left > label {
  font-size: 11px; font-weight: 700; color: #fff;
  background: #1d4ed8; padding: 7px 12px; flex-shrink: 0;
}
.erp-ref-speclist {
  flex: 1; overflow-y: auto; padding: 0 4px 4px; min-height: 0;
}
.erp-ref-speclist .erp-spec-item { padding: 3px 8px; font-size: 11px; cursor: pointer; border-radius: 3px; }
.erp-ref-speclist .erp-spec-item:hover { background: #eef2ff; }
.erp-ref-speclist .erp-spec-item.active { background: #3b82f6; color: #fff; font-weight: 600; }
.erp-ref-right {
  flex: 1; overflow: auto; padding: 8px; min-width: 0;
}
.erp-ref-right table { width: 100%; border-collapse: collapse; font-size: 11px; table-layout: fixed; }
.erp-ref-right th { background: #1e293b; color: #fff; padding: 5px 6px; font-weight: 700; font-size: 10px; border-bottom: 2px solid #e2e8f0; position: sticky; top: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.erp-ref-right td { padding: 4px 6px; border-bottom: 1px solid #f1f5f9; font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.erp-ref-right tr:nth-child(even) { background: #e8edf4; }
.erp-ref-right td:hover { overflow: visible; white-space: normal; word-break: break-all; background: #fefce8; position: relative; z-index: 5; }
.erp-ref-right .r { text-align: right; }
.erp-ref-right col.rc-spec { width: 12%; }
.erp-ref-right col.rc-name { width: 12%; }
.erp-ref-right col.rc-pno { width: 7%; }
.erp-ref-right col.rc-od { width: 5%; }
.erp-ref-right col.rc-len { width: 5%; }
.erp-ref-right col.rc-mat { width: 13%; }
.erp-ref-right col.rc-rmk { width: 18%; }
.erp-ref-right col.rc-cust { width: 10%; }
.erp-ref-right col.rc-prod { width: 7%; }
.erp-ref-right col.rc-yr { width: 7%; }
.erp-ref-right col.rc-mo { width: 6%; }

/* ===== 도면뷰어 탭 ===== */
.erp-dv-left {
  width: 280px;
  min-width: 280px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.erp-dv-left > label {
  font-size: 11px; font-weight: 700; color: #fff;
  background: #1d4ed8; padding: 7px 12px; flex-shrink: 0;
}
.erp-dv-speclist {
  flex: 1; overflow-y: auto;
}
.erp-dv-right {
  flex: 1; overflow: hidden; display: flex; flex-direction: column;
}
.erp-dv-right iframe {
  width: 100%; height: 100%; border: none;
}
/* 도면뷰어 - 트리 폴더 */
.dv-folder-header {
  padding: 6px 8px; font-size: 12px; font-weight: 600; cursor: pointer;
  border-bottom: 1px solid #e2e8f0; color: #1e293b;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  -webkit-user-select: none; user-select: none;
}
.dv-group-header { background: #e2e8f0; font-size: 13px; }
.dv-group-header:hover { background: #cbd5e1; }
.dv-group-header.empty { opacity: 0.45; cursor: default; }
.dv-sub-header { background: #f1f5f9; padding-left: 20px; font-size: 12px; }
.dv-sub-header:hover { background: #e2e8f0; }
.dv-folder-arrow { display: inline-block; width: 12px; font-size: 11px; color: #64748b; }
.dv-folder-icon { font-size: 13px; }
.dv-folder-count { font-size: 10px; color: #94a3b8; font-weight: 400; }
.dv-group-name { font-weight: 700; }
/* 도면뷰어 - 파일 항목 */
.dv-file-item {
  padding: 5px 8px; font-size: 12px; cursor: pointer; border-bottom: 1px solid #f1f5f9;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dv-file-item:hover { background: #eef2ff; }
.dv-file-item.active { background: #3b82f6; color: #fff; font-weight: 600; }
.dv-file-item.dv-file-depth1 { padding-left: 20px; }
.dv-file-item.dv-file-depth2 { padding-left: 36px; font-size: 11px; }

.erp-equip-body {
  overflow: auto;
  height: calc(100vh - 105px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
}
.erp-hours-body {
  overflow: auto;
  height: calc(100vh - 105px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
}

/* 작업반 바 */
.erp-team-bar {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  padding: 8px 10px;
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  min-height: 38px;
  align-items: center;
}

.erp-team-bar .ef-toggle-label {
  margin-right: 4px;
}

.erp-team-bar .ef-toggle {
  padding: 3px 10px;
  font-size: 12px;
}

.erp-team-body {
  overflow: auto;
  height: calc(100vh - 105px);
  background: #fff;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
}

.erp-tab-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: calc(100vh - 105px);
  color: #94a3b8;
  font-size: 16px;
  font-weight: 600;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* 좌+중 래퍼 (도면을 두 영역 아래 가로 전체에 배치) */
.erp-area3-leftmid {
  flex: 4 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.erp-area3-top {
  flex: 7;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

/* 3영역: 좌(Spec) + 중(공정흐름) + 우(KPI) */
.erp-area3 {
  display: flex;
  gap: 0;
  height: calc(100vh - 100px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: #fff;
}

/* 좌: Spec 리스트 */
.erp-area3-left {
  width: 170px;
  min-width: 170px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.erp-area3-left > label {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: #1d4ed8;
  padding: 7px 12px;
  flex-shrink: 0;
  letter-spacing: 0.3px;
}
.erp-spec-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 4px 4px;
  min-height: 0;
}
.erp-spec-item {
  padding: 2px 6px;
  font-size: 11px;
  color: #334155;
  cursor: pointer;
  border-radius: 4px;
  white-space: nowrap;
}
.erp-spec-item:hover {
  background: #e2e8f0;
}
.erp-spec-item.active {
  background: #93c5fd;
  color: #1e3a8a;
  font-weight: 700;
}

/* 중: 공정흐름 */
.erp-area3-mid {
  flex: 4 1 0;
  display: flex;
  flex-direction: column;
  min-width: 200px;
}
.erp-area3-mid > label {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: #1d4ed8;
  padding: 7px 12px;
  flex-shrink: 0;
  letter-spacing: 0.3px;
}
.erp-area3-mid .erp-flow {
  flex: 1;
  overflow-y: auto;
  padding: 0 4px 4px;
  margin: 0;
  min-height: 0;
  min-height: 0;
}

/* 제품 정보 패널 (공정흐름 하단 50%) */
.erp-product-info {
  flex: 1;
  overflow-y: auto;
  border-top: 2px solid #cbd5e1;
  padding: 6px;
  min-height: 0;
  background: #fafbfc;
}
.erp-product-info-title {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 6px;
}
.product-info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.product-info-table th {
  background: #f1f5f9;
  padding: 3px 6px;
  text-align: left;
  font-weight: 600;
  border: 1px solid #e2e8f0;
  white-space: nowrap;
}
.product-info-table td {
  padding: 3px 6px;
  border: 1px solid #e2e8f0;
}
.product-info-table tr:hover { background: #f8fafc; }

/* 리사이즈 핸들 */
.erp-resize-handle {
  width: 5px;
  cursor: col-resize;
  background: var(--border);
  flex-shrink: 0;
  transition: background 0.15s;
}
.erp-resize-handle:hover,
.erp-resize-handle.dragging {
  background: #1a73e8;
}

/* 우: KPI */
.erp-area3-right {
  flex: 6 1 0;
  min-width: 200px;
  display: flex;
  flex-direction: column;
}
.erp-area3-right > label {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: #1d4ed8;
  padding: 7px 12px;
  flex-shrink: 0;
  letter-spacing: 0.3px;
}
.erp-kpi {
  flex: 1;
  overflow-y: auto;
  padding: 0 6px 6px;
  font-size: 12px;
}
.erp-kpi:empty::after {
  content: '공장/제품군 선택 시 표시';
  color: #94a3b8;
  font-size: 13px;
  display: block;
  padding: 30px 0;
  text-align: center;
}
.kpi-section { margin-bottom: 16px; }
.kpi-section h4 {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: #334155;
  margin-bottom: 0;
  padding: 6px 10px;
  border-radius: 6px 6px 0 0;
  position: sticky;
  top: 0;
  z-index: 2;
}
.kpi-section h4.kpi-sub {
  background: #475569;
  border-radius: 0;
  font-size: 11px;
  padding: 4px 10px;
  margin-top: 10px;
  color: #fff;
}
.kpi-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.kpi-table th {
  background: #f1f5f9;
  padding: 4px 8px;
  text-align: left;
  font-weight: 600;
  border: 1px solid #e2e8f0;
  position: sticky;
  top: 28px;
  z-index: 1;
}
.kpi-table td {
  padding: 4px 8px;
  border: 1px solid #e2e8f0;
}
.kpi-table tr:hover { background: #f8fafc; }
.kpi-table tr.kpi-subtotal td {
  background: #e2e8f0;
  font-weight: 700;
  border-top: 2px solid #94a3b8;
}
.kpi-table .r, .kpi-table th.r { text-align: right; }
.kpi-val-good { color: #16a34a; font-weight: 600; }
.kpi-val-bad { color: #dc2626; font-weight: 600; }
.kpi-expand-btn {
  display: inline-flex; align-items: center; gap: 4px;
  cursor: pointer; color: var(--primary); font-weight: 700; font-size: 12px;
  padding: 2px 8px; border-radius: 4px; transition: background 0.15s;
  background: #eef2ff; border: 1px solid #c7d2fe;
}
.kpi-expand-btn:hover { background: var(--primary-light); border-color: var(--primary); }
.erp-flow:empty::after {
  content: '제품군을 선택하면 공정흐름이 표시됩니다';
  color: #94a3b8;
  font-size: 13px;
  display: block;
  padding: 40px 0;
  text-align: center;
}

/* 토글 버튼 공통 */
.ef-toggle {
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s;
}
.ef-toggle:hover {
  background: var(--primary-light);
  border-color: #bfdbfe;
  color: var(--primary);
}
.ef-toggle.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 2px 6px rgba(37,99,235,0.25);
}
.ef-toggle.ef-disabled {
  opacity: 0.25;
  cursor: not-allowed;
  pointer-events: none;
}
.ef-toggle-label {
  font-size: 12px;
  font-weight: 700;
  color: #94a3b8;
  margin-right: 6px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
#erp-load-btn {
  padding: 6px 18px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 2px 6px rgba(37,99,235,0.2);
}
#erp-load-btn:hover { background: var(--primary-dark); box-shadow: 0 3px 10px rgba(37,99,235,0.3); }
.erp-db-status {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
  background: #fef2f2;
  color: #ef4444;
}
.erp-db-status.loaded {
  background: #f0fdf4;
  color: #16a34a;
}

#ef-apply {
  padding: 8px 16px;
  background: #1a73e8;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
#ef-apply:hover { background: #1557b0; }
#ef-reset {
  padding: 6px 16px;
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}
#ef-reset:hover { background: #e2e8f0; }
#ef-count { font-size: 12px; color: #64748b; text-align: center; }

/* 공정흐름 테이블 */
.erp-flow {
  min-height: 0;
  margin: 0;
}
.erp-flow:empty { display: none; }

.flow-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  table-layout: fixed;
}
.flow-table th {
  padding: 3px 2px;
  text-align: center;
  font-weight: 700;
  color: #1e293b;
  border-bottom: 2px solid #e2e8f0;
  border-right: 1px solid #f1f5f9;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
  font-size: 11px;
  vertical-align: top;
}
.flow-select-all {
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 700;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  color: #64748b;
  cursor: pointer;
}
.flow-select-all:hover {
  background: #1a73e8;
  color: #fff;
  border-color: #1a73e8;
}
.flow-th-code:hover {
  background: #eff6ff !important;
  color: #1a73e8;
}
.flow-table th:first-child {
  width: 36px;
  border-right: 1px solid #e2e8f0;
}
.flow-table th .th-name {
  display: block;
  font-size: 8px;
  font-weight: 400;
  color: #94a3b8;
  line-height: 1.1;
  max-height: 18px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.flow-table td {
  padding: 2px 1px;
  text-align: center;
  border-bottom: 1px solid #f1f5f9;
  border-right: 1px solid #f1f5f9;
}
.flow-table td:first-child {
  border-right: 1px solid #e2e8f0;
}
.flow-table .flow-cnt {
  font-size: 11px;
  color: #64748b;
  font-weight: 600;
  text-align: right;
  padding-right: 6px;
  white-space: nowrap;
}
.flow-table .flow-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #93c5fd;
  display: inline-block;
}
.flow-table .flow-arrow-cell {
  color: #cbd5e1;
  font-size: 10px;
}
.flow-table tr { cursor: pointer; }
.flow-table tr:hover td { background: #f8fafc; }

/* 하이라이트 (spec 선택) */
.flow-table tr.highlighted td { background: #eff6ff; }
.flow-table tr.highlighted .flow-dot { background: #1a73e8; }

/* 그룹 클릭 선택 */
.flow-table tr.flow-total td {
  background: #e2e8f0;
  font-weight: 700;
  color: #1e293b;
  border-top: 2px solid #94a3b8;
  font-size: 11px;
}
.flow-table tr.flow-total { cursor: default; }
.flow-table tr.flow-total:hover td { background: #e2e8f0; }

.flow-table tr.flow-selected td { background: #fef3c7; }
.flow-table tr.flow-selected .flow-dot { background: #f59e0b; }
.flow-table tr.flow-selected .flow-cnt { color: #92400e; }

/* Spec 리스트: 공정흐름 매칭 */
.erp-spec-item.flow-match {
  background: #fef3c7;
  color: #92400e;
  font-weight: 600;
}

/* 분석 탭 */
.erp-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 0;
  border-bottom: 2px solid var(--border);
}
.erp-tab {
  padding: 10px 20px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  font-size: 14px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  margin-bottom: -2px;
}
.erp-tab:hover { color: #1e293b; }
.erp-tab.active {
  color: #1a73e8;
  border-bottom-color: #1a73e8;
}

/* 분석 결과 */
.erp-result {
  background: #fff;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  overflow: auto;
  min-height: 200px;
  max-height: calc(100vh - 460px);
}
.erp-result-info {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 10px;
}
.erp-result-info strong { color: #1e293b; }

/* SQL 패널 */
.erp-sql-panel {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.erp-sql-panel.hidden { display: none; }
.erp-sql-panel textarea {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: 'Consolas', monospace;
  font-size: 13px;
  resize: vertical;
}
#erp-run-btn {
  padding: 10px 20px;
  background: #1a73e8;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
#erp-run-btn:hover { background: #1557b0; }

/* ===== 3-Panel Skill Detail ===== */
.skill-3panel {
  display: flex;
  gap: 0;
  height: calc(100vh - 20px);
  margin: -8px -10px;
}

#skill-file-sidebar {
  width: 340px;
  min-width: 340px;
  background: #e8ecf2;
  color: #1e293b;
  overflow-y: auto;
  flex-shrink: 0;
  border-right: 2px solid #e2e8f0;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 스킬 요약 (보조메뉴 상단) */
#skill-summary {
  padding: 20px 18px 16px;
  flex-shrink: 0;
  background: #ffffff;
}

#skill-summary .sum-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

#skill-summary .sum-id {
  font-size: 13px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 5px;
  color: #fff;
}

#skill-summary .sum-name {
  font-size: 17px;
  font-weight: 700;
  color: #1e293b;
}

#skill-summary .sum-version {
  font-size: 11px;
  background: #e0f2fe;
  color: #0369a1;
  padding: 2px 8px;
  border-radius: 8px;
  font-weight: 600;
}

#skill-summary .sum-desc {
  font-size: 13px;
  color: #475569;
  line-height: 1.7;
  margin-bottom: 12px;
}

#skill-summary .sum-trigger {
  font-size: 13px;
  color: #166534;
  background: #f0fdf4;
  border-left: 3px solid #22c55e;
  padding: 8px 12px;
  border-radius: 0 6px 6px 0;
  margin-bottom: 12px;
  line-height: 1.6;
}

#skill-summary .sum-features {
  list-style: none;
  padding: 0;
}

#skill-summary .sum-features li {
  font-size: 13px;
  color: #334155;
  padding: 3px 0;
  line-height: 1.5;
}

#skill-summary .sum-features li::before {
  content: '▸ ';
  color: var(--primary);
  font-weight: 700;
}

#skill-summary .sum-meta {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

#skill-summary .sum-badge {
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 10px;
  font-weight: 600;
}

.sum-badge.tier-1 { background: #fee2e2; color: #991b1b; }
.sum-badge.tier-2 { background: #fef3c7; color: #92400e; }
.sum-badge.tier-3 { background: #e0e7ff; color: #3730a3; }

.sum-zip-btn {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 16px;
  background: #1a73e8;
  color: #fff;
  border-radius: 6px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}

.sum-zip-btn:hover {
  background: #1557b0;
}

.sidebar-divider {
  height: 2px;
  background: #e2e8f0;
  flex-shrink: 0;
}

#skill-file-tree {
  padding: 8px 0;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  background: #dde3ed;
}

.ftree-group {
  margin-bottom: 2px;
}

.ftree-dir {
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ftree-dir:hover { color: #1e293b; }

.ftree-dir .dir-icon { font-size: 12px; }

.ftree-file {
  padding: 6px 10px 6px 32px;
  font-size: 13px;
  color: #475569;
  cursor: pointer;
  transition: all 0.12s;
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.ftree-file:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.ftree-file.active {
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 600;
}

.ftree-file .ficon {
  font-size: 10px;
  font-weight: 700;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
  border-radius: 3px;
  padding: 1px 0;
}

.ftree-file .ficon.markdown { color: #2563eb; background: #dbeafe; }
.ftree-file .ficon.json { color: #b45309; background: #fef3c7; }
.ftree-file .ficon.python { color: #047857; background: #d1fae5; }
.ftree-file .ficon.html { color: #dc2626; background: #fee2e2; }
.ftree-file .ficon.shell { color: #6b21a8; background: #f3e8ff; }
.ftree-file .ficon.text { color: #475569; background: #e2e8f0; }
.ftree-file .ficon.database { color: #0e7490; background: #cffafe; }
.ftree-file .ficon.pdf { color: #be123c; background: #ffe4e6; }
.ftree-file .ficon.document { color: #1d4ed8; background: #dbeafe; }
.ftree-file .ficon.image { color: #7c3aed; background: #ede9fe; }
.ftree-fname {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ftree-dl {
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
  text-decoration: none;
  padding: 3px 8px;
  border-radius: 4px;
  flex-shrink: 0;
  background: #e2e8f0;
  line-height: 1;
}

.ftree-dl:hover {
  background: #1a73e8;
  color: #fff;
}

.ftree-file .ficon.excel { color: #15803d; background: #dcfce7; }
.ftree-file .ficon.powerpoint { color: #c2410c; background: #ffedd5; }
.ftree-file .ficon.word { color: #1d4ed8; background: #dbeafe; }

#skill-main-content {
  flex: 1;
  padding: 0;
  overflow-y: auto;
  min-width: 0;
  height: 100vh;
}

/* File Viewer */
#file-viewer {
  height: 100%;
  display: flex;
  flex-direction: column;
}

#file-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: #f1f5f9;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

#file-viewer-header .fv-path { opacity: 0.5; font-weight: 400; margin-left: 8px; font-size: 12px; }

#file-viewer-body {
  background: #fff;
  padding: 28px 36px;
  overflow: auto;
  flex: 1;
  font-size: 14px;
  line-height: 1.8;
  color: #1e293b;
  min-height: 0;
}

/* 본문 내 콘텐츠가 부모 폭을 넘지 않도록 */
#file-viewer-body > * {
  max-width: 100%;
  overflow-x: auto;
}

/* HTML/MD iframe */
#file-viewer-body iframe.html-preview {
  width: 100%;
  border: none;
}

/* 빈 상태 */
.viewer-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #94a3b8;
  font-size: 14px;
}

/* JSON Viewer */
.json-viewer { font-family: 'Consolas', 'Courier New', monospace; font-size: 13px; line-height: 1.6; }
.json-viewer .jv-key { color: #0550ae; font-weight: 600; }
.json-viewer .jv-str { color: #0a3069; }
.json-viewer .jv-num { color: #0550ae; }
.json-viewer .jv-bool { color: #cf222e; }
.json-viewer .jv-null { color: #8250df; }

.json-viewer .jv-toggle {
  cursor: pointer;
  color: #656d76;
  -webkit-user-select: none;
  user-select: none;
}
.json-viewer .jv-toggle:hover { color: #0550ae; }
.json-viewer .jv-collapsed { display: none; }

.json-viewer .jv-bracket { color: #656d76; }

/* JSON Table (for arrays of objects) */
.json-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin: 8px 0;
}

.json-table th {
  background: #f1f5f9;
  padding: 6px 10px;
  text-align: left;
  font-weight: 600;
  border: 1px solid #e0e4e8;
  white-space: nowrap;
  position: sticky;
  top: 0;
}

.json-table td {
  padding: 5px 10px;
  border: 1px solid #e0e4e8;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.json-table tr:nth-child(even) { background: #f8fafc; }
.json-table tr:hover { background: #eff6ff; }

/* Markdown rendered */
.md-rendered h1 { font-size: 22px; margin: 20px 0 10px; border-bottom: 2px solid #e2e8f0; padding-bottom: 6px; color: #0f172a; }
.md-rendered h2 { font-size: 19px; margin: 18px 0 8px; color: #1e293b; }
.md-rendered h3 { font-size: 16px; margin: 14px 0 6px; color: #334155; }
.md-rendered h4 { font-size: 15px; margin: 12px 0 4px; color: #475569; }
.md-rendered p { margin: 8px 0; color: #334155; }
.md-rendered ul, .md-rendered ol { padding-left: 24px; margin: 6px 0; }
.md-rendered li { margin: 3px 0; color: #334155; }
.md-rendered code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: 13px; color: #dc2626; }
.md-rendered pre { background: #f8fafc; color: #1e293b; padding: 16px; border-radius: 8px; overflow-x: auto; margin: 10px 0; border: 1px solid #e2e8f0; }
.md-rendered pre code { background: none; color: #334155; font-size: 13px; }
.md-rendered table { border-collapse: collapse; margin: 10px 0; font-size: 13px; width: 100%; }
.md-rendered th, .md-rendered td { border: 1px solid #e0e4e8; padding: 8px 12px; }
.md-rendered th { background: #f1f5f9; font-weight: 600; text-align: left; }
.md-rendered blockquote { border-left: 4px solid #3b82f6; padding: 10px 16px; color: #475569; margin: 10px 0; background: #f8fafc; border-radius: 0 6px 6px 0; }
.md-rendered strong { font-weight: 700; color: #0f172a; }
.md-rendered em { font-style: italic; }
.md-rendered hr { border: none; border-top: 1px solid #e2e8f0; margin: 16px 0; }

/* Python/Code block */
.code-block {
  background: #f8fafc;
  color: #1e293b;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre;
  tab-size: 4;
}

/* ===== Timeline (Updates) ===== */
.timeline {
  position: relative;
  padding-left: 24px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 6px; top: 0; bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  margin-bottom: 20px;
  padding-left: 20px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -22px; top: 6px;
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  background: #fff;
}

.timeline-item.type-notice::before {
  border-color: var(--notice);
  background: var(--notice);
}

.timeline-item.type-update::before {
  border-color: var(--update);
  background: var(--update);
}

.timeline-item .tl-date { font-size: 11px; color: #94a3b8; margin-bottom: 3px; }

.timeline-item .tl-title { font-size: 14px; font-weight: 700; margin-bottom: 4px; color: #0f172a; }

.tl-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 10px;
  margin-left: 6px;
  font-weight: 500;
}

.tl-badge.notice { background: rgba(245,158,11,0.12); color: #b45309; }
.tl-badge.update { background: rgba(16,185,129,0.12); color: #047857; }

.timeline-item .tl-content { font-size: 13px; color: var(--text-light); line-height: 1.6; }

/* ===== Placeholder ===== */
.placeholder-msg {
  color: var(--text-light);
  font-size: 14px;
  padding: 40px 0;
  text-align: center;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  #sidebar { transform: translateX(-100%); }
  #sidebar.open { transform: translateX(0); }
  #menu-toggle { display: block; }
  #content { margin-left: 0; padding: 16px; padding-top: 56px; }
  .stats-row { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stat-card { padding: 14px 6px; }
  .stat-number { font-size: 22px; }
  .home-split { flex-direction: column; height: auto; }
  .home-left { width: 100%; min-width: 0; border-right: none; border-bottom: 2px solid var(--border); }
  .pipeline-step { flex-direction: column; align-items: flex-start; gap: 4px; }
  .pipeline-split { flex-direction: column; }
  .skill-3panel { flex-direction: column; height: auto; }
  #skill-file-sidebar { width: 100%; min-width: 0; max-height: 300px; height: auto; border-right: none; border-bottom: 1px solid #334155; position: relative; }
  #skill-main-content { height: auto; min-height: 60vh; }
}

/* ===== 탭3: 품질지표 ===== */
.erp-quality-body {
  overflow: auto;
  height: calc(100vh - 105px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}
.q-grid { display: flex; gap: 12px; margin-bottom: 14px; }
.q-grid > div { flex: 1; min-width: 0; }
.q-section { margin-bottom: 16px; }
.q-section-title {
  font-size: 13px; font-weight: 700; color: #1e293b;
  padding: 8px 12px; margin-bottom: 8px;
  border-left: 4px solid var(--primary); background: #f8fafc;
  border-radius: 0 6px 6px 0;
}
.q-pareto-row {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 0; font-size: 12px;
}
.q-pareto-label {
  width: 220px; text-align: right; color: #334155; font-size: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0;
}
.q-pareto-bar-wrap {
  flex: 1; height: 22px; background: #f1f5f9; border-radius: 4px; overflow: hidden; position: relative;
}
.q-pareto-bar {
  height: 100%; background: linear-gradient(90deg, #ef4444 0%, #f97316 100%); border-radius: 4px;
  display: flex; align-items: center; justify-content: flex-end; padding-right: 6px;
  font-size: 11px; font-weight: 700; color: #fff; min-width: 30px;
  transition: width 0.4s ease;
}
.q-pareto-val { width: 80px; text-align: right; font-weight: 700; color: #334155; font-size: 12px; flex-shrink: 0; }
.q-pareto-line {
  position: absolute; top: 0; height: 100%; width: 2px; background: #1d4ed8; z-index: 2;
}
.q-period-badge {
  display: inline-block; padding: 2px 10px; border-radius: 12px;
  background: var(--primary); color: #fff; font-size: 11px; font-weight: 600;
  float: right; margin-top: -2px;
}
.q-insight-box {
  border: 1px solid #e2e8f0; border-radius: 8px; padding: 14px 16px;
  background: #fefefe;
}
.q-insight-box.critical { border-left: 4px solid #ef4444; }
.q-insight-box.positive { border-left: 4px solid #16a34a; }
.q-insight-box h5 { font-size: 13px; margin-bottom: 8px; }
.q-insight-box h5.critical-title { color: #dc2626; }
.q-insight-box h5.positive-title { color: #16a34a; }
.q-insight-box li { font-size: 12px; color: #334155; line-height: 1.7; margin-bottom: 2px; }
.q-summary-cards { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.q-summary-card {
  flex: 1; min-width: 140px; padding: 12px 14px;
  background: #e8f0fe; border: 1px solid #bfcfea; border-top: 3px solid var(--primary); border-radius: 8px; text-align: center;
}
.q-summary-card .q-num { font-size: 24px; font-weight: 800; color: #1e3a8a; }
.q-summary-card .q-label { font-size: 11px; color: #3b5998; margin-top: 2px; font-weight: 600; }
.q-summary-card.warn .q-num { color: #dc2626; }
.q-summary-card.warn { background: #fff0f0; border-top-color: #dc2626; border-color: #fca5a5; }
.q-month-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.q-month-table th { background: #f1f5f9; padding: 5px 6px; font-weight: 700; text-align: center; border-bottom: 2px solid #e2e8f0; }
.q-month-table td { padding: 4px 6px; text-align: right; border-bottom: 1px solid #f1f5f9; }
.q-month-table td:first-child { text-align: center; font-weight: 600; }
.q-top-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.q-top-table th { background: #f1f5f9; padding: 5px 8px; font-weight: 700; border-bottom: 2px solid #e2e8f0; }
.q-top-table td { padding: 4px 8px; border-bottom: 1px solid #f1f5f9; }
.q-top-table .r { text-align: right; }
.q-rank { display: inline-block; width: 20px; height: 20px; line-height: 20px; text-align: center; border-radius: 50%; font-size: 10px; font-weight: 700; color: #fff; }
.q-rank-1 { background: #ef4444; }
.q-rank-2 { background: #f97316; }
.q-rank-3 { background: #eab308; }
.q-rank-n { background: #94a3b8; }
