/* ===== 기본 설정 ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Noto Sans KR', sans-serif;
  background: #0f1117;
  color: #e2e8f0;
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== 로딩 오버레이 ===== */
#loading-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(15,17,23,0.92);
  display: flex; align-items: center; justify-content: center;
}
#loading-overlay.hidden { display: none; }
.loading-box {
  text-align: center;
  background: #1e2130;
  border: 1px solid #2d3449;
  border-radius: 16px;
  padding: 40px 60px;
}
.loading-box i { font-size: 3rem; color: #6366f1; margin-bottom: 16px; }
.loading-box p { font-size: 1.1rem; font-weight: 600; margin-bottom: 8px; }
.loading-box small { color: #8892a0; font-size: 0.85rem; }

/* ===== 사이드바 ===== */
#sidebar {
  width: 220px;
  min-width: 220px;
  background: #141720;
  border-right: 1px solid #1e2435;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  transition: width 0.25s;
}
#sidebar.collapsed { width: 0; min-width: 0; overflow: hidden; }

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid #1e2435;
}
.sidebar-header > i { font-size: 1.4rem; color: #6366f1; }
.brand-mark {
  min-width: 52px;
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  background: #f8fafc;
  color: #111827;
  font-weight: 700;
  font-size: 0.63rem;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sidebar-title { font-weight: 700; font-size: 0.95rem; color: #f1f5f9; }
.sidebar-sub { font-size: 0.72rem; color: #64748b; }

.nav-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #475569;
  text-transform: uppercase;
  padding: 14px 16px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  font-size: 0.83rem;
  color: #94a3b8;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.nav-item:hover { background: #1e2435; color: #e2e8f0; }
.nav-item.active {
  background: #1e2435;
  color: #818cf8;
  border-left-color: #6366f1;
  font-weight: 600;
}
.nav-item i { width: 18px; text-align: center; font-size: 0.85rem; }

/* 포장 서브메뉴 */
.nav-group { display: flex; flex-direction: column; }
.nav-parent { position: relative; }
.nav-arrow { transition: transform 0.2s; font-size: 0.6rem !important; width: auto !important; }
.nav-group.open .nav-arrow { transform: rotate(180deg); }
.nav-sub-menu {
  display: none;
  background: #0a0f1e;
  border-left: 1px solid #1e2435;
  margin-left: 16px;
}
.nav-group.open .nav-sub-menu { display: block; }
.nav-sub-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px 7px 12px;
  font-size: 0.77rem;
  color: #64748b;
  cursor: pointer;
  border-left: 2px solid transparent;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}
.nav-sub-item:hover { color: #e2e8f0; background: #1a2035; }
.nav-sub-item.active { color: #818cf8; border-left-color: #6366f1; background: #1e2435; font-weight: 600; }
.nav-sub-item.disabled { pointer-events: none; opacity: 0.4; cursor: not-allowed; }
.nav-sub-item i { width: 14px; text-align: center; font-size: 0.72rem; }
.nav-new-badge {
  margin-left: auto;
  background: #6366f1;
  color: #fff;
  font-size: 0.55rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 16px;
  border-top: 1px solid #1e2435;
  font-size: 0.72rem;
  color: #475569;
  line-height: 1.7;
}

/* ===== 메인 컨텐츠 ===== */
#main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ===== 상단 헤더 ===== */
.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: #141720;
  border-bottom: 1px solid #1e2435;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 12px;
}
.header-left { display: flex; align-items: center; gap: 14px; }
.header-left h1 { font-size: 1.1rem; font-weight: 700; color: #f1f5f9; }
.menu-btn {
  background: none; border: none; color: #94a3b8;
  font-size: 1.1rem; cursor: pointer; padding: 4px;
}
.header-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.sheets-status {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.78rem; color: #94a3b8;
  background: #1e2435; border-radius: 20px;
  padding: 5px 12px;
}
.status-dot { font-size: 0.55rem; }
.status-dot.connected { color: #10b981; }
.status-dot.disconnected { color: #6b7280; }

.date-filter { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; }
.date-filter label { color: #64748b; }
.date-filter select {
  background: #1e2435; border: 1px solid #2d3449; color: #e2e8f0;
  border-radius: 6px; padding: 5px 10px; font-size: 0.8rem; cursor: pointer;
}

.countdown-badge {
  background: #1e2435; border: 1px solid #2d3449;
  border-radius: 20px; padding: 5px 12px;
  font-size: 0.78rem; color: #94a3b8;
  display: flex; align-items: center; gap: 6px;
}

.refresh-btn {
  background: #6366f1; border: none; color: #fff;
  border-radius: 8px; padding: 7px 14px;
  font-size: 0.8rem; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  transition: background 0.15s;
}
.refresh-btn:hover { background: #4f46e5; }

/* ===== 뷰 섹션 ===== */
.view { display: none; padding: 20px 24px; flex-direction: column; gap: 18px; }
.view.active { display: flex; }

/* ===== KPI 카드 ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
}
.kpi-grid.small { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .kpi-grid.small { grid-template-columns: repeat(2, 1fr); }
}

.kpi-card {
  background: #1e2130;
  border: 1px solid #2d3449;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: transform 0.15s;
}
.kpi-card:hover { transform: translateY(-2px); }
.kpi-icon {
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; flex-shrink: 0;
}
.accent-blue .kpi-icon { background: rgba(99,102,241,0.15); color: #818cf8; }
.accent-green .kpi-icon { background: rgba(16,185,129,0.15); color: #34d399; }
.accent-red .kpi-icon { background: rgba(239,68,68,0.15); color: #f87171; }
.accent-orange .kpi-icon { background: rgba(245,158,11,0.15); color: #fbbf24; }
.accent-purple .kpi-icon { background: rgba(168,85,247,0.15); color: #c084fc; }
.accent-teal .kpi-icon { background: rgba(20,184,166,0.15); color: #2dd4bf; }

.kpi-label { font-size: 0.73rem; color: #64748b; font-weight: 500; margin-bottom: 4px; }
.kpi-value {
  font-size: 1.5rem; font-weight: 700; color: #f1f5f9; line-height: 1;
  margin-bottom: 4px;
}
.kpi-value.small-val { font-size: 1rem; }
.kpi-sub { font-size: 0.72rem; color: #475569; }

/* ===== 차트 박스 ===== */
.chart-row { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
@media (max-width: 900px) { .chart-row { grid-template-columns: 1fr; } }
.chart-box {
  background: #1e2130; border: 1px solid #2d3449;
  border-radius: 12px; padding: 18px;
}
.chart-box.wide { }
.chart-title {
  font-size: 0.85rem; font-weight: 600; color: #94a3b8;
  margin-bottom: 14px; display: flex; align-items: center; gap: 8px;
}
.chart-badge {
  font-size: 0.7rem; background: #2d3449; color: #94a3b8;
  border-radius: 4px; padding: 2px 7px;
}

/* ===== 섹션 박스 ===== */
.section-box {
  background: #1e2130; border: 1px solid #2d3449;
  border-radius: 12px; padding: 18px; overflow: hidden;
}
.section-title {
  font-size: 0.9rem; font-weight: 700; color: #e2e8f0;
  margin-bottom: 14px; display: flex; align-items: center; gap: 8px;
}
.section-sub { font-size: 0.72rem; color: #475569; font-weight: 400; }

/* ===== 데이터 테이블 ===== */
.data-table {
  width: 100%; border-collapse: collapse; font-size: 0.8rem;
}
.data-table th {
  background: #141720; color: #64748b; font-weight: 600;
  padding: 9px 12px; text-align: left; border-bottom: 1px solid #2d3449;
  white-space: nowrap;
}
.data-table td {
  padding: 8px 12px; border-bottom: 1px solid #1e2435;
  color: #cbd5e1; vertical-align: middle;
}
.data-table tr:hover td { background: rgba(99,102,241,0.04); }
.data-table.small td { padding: 6px 12px; font-size: 0.76rem; }
.no-data { text-align: center; color: #475569; padding: 24px !important; }

/* 위험등급 배지 */
.badge { display: inline-block; border-radius: 4px; padding: 2px 8px; font-size: 0.72rem; font-weight: 600; }
.badge-danger { background: rgba(239,68,68,0.15); color: #f87171; }
.badge-warning { background: rgba(245,158,11,0.15); color: #fbbf24; }
.badge-ok { background: rgba(16,185,129,0.15); color: #34d399; }
.badge-done { background: rgba(99,102,241,0.15); color: #818cf8; }

/* ===== 일별 진도현황 ===== */
.daily-kpi-row {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px;
}
@media (max-width: 1200px) { .daily-kpi-row { grid-template-columns: repeat(3, 1fr); } }
.daily-kpi-card {
  background: #1e2130; border: 1px solid #2d3449;
  border-radius: 12px; padding: 16px;
}
.daily-kpi-card.highlight {
  border-color: #6366f1; background: rgba(99,102,241,0.08);
}
.daily-kpi-card.warn { border-color: rgba(239,68,68,0.4); }
.daily-kpi-label {
  font-size: 0.75rem; color: #64748b; margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.daily-kpi-value {
  font-size: 1.5rem; font-weight: 700; color: #f1f5f9;
  margin-bottom: 4px;
}
.daily-kpi-sub { font-size: 0.72rem; color: #475569; }
.daily-kpi-card.green .daily-kpi-value { color: #34d399; }
.daily-kpi-card.red .daily-kpi-value { color: #f87171; }
.daily-kpi-card.orange .daily-kpi-value { color: #fbbf24; }

/* 진도 게이지 */
.progress-section {
  background: #1e2130; border: 1px solid #2d3449;
  border-radius: 12px; padding: 20px;
}
.progress-label-row {
  display: flex; justify-content: space-between;
  font-size: 0.85rem; font-weight: 600; color: #94a3b8;
  margin-bottom: 12px;
}
.big-progress-bar {
  width: 100%; height: 32px; background: #2d3449;
  border-radius: 8px; overflow: hidden; position: relative;
}
.big-progress-fill {
  height: 100%; background: linear-gradient(90deg, #6366f1, #818cf8);
  border-radius: 8px; transition: width 0.6s ease;
  display: flex; align-items: center;
}
.progress-target-marker {
  position: absolute; top: 0; bottom: 0;
  width: 2px; background: #fbbf24;
}
.progress-label-inside {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  font-size: 0.78rem; font-weight: 700; color: #fff;
}
.progress-legend {
  display: flex; gap: 20px; margin-top: 10px; font-size: 0.75rem; color: #64748b;
}
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-dot {
  width: 10px; height: 10px; border-radius: 50%;
}
.legend-dot.blue { background: #6366f1; }
.legend-dot.gray { background: #fbbf24; }

/* 공정 탭 */
.proc-tab-row {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.proc-tab-btn {
  background: #1e2435; border: 1px solid #2d3449;
  color: #94a3b8; border-radius: 20px;
  padding: 6px 14px; font-size: 0.78rem; cursor: pointer;
  transition: all 0.15s;
}
.proc-tab-btn:hover { border-color: #6366f1; color: #818cf8; }
.proc-tab-btn.active {
  background: #6366f1; border-color: #6366f1;
  color: #fff; font-weight: 600;
}

/* ===== 공정 상세 ===== */
.proc-header {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 4px;
}
.proc-icon {
  width: 52px; height: 52px; border-radius: 12px;
  background: rgba(99,102,241,0.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; color: #818cf8;
}
.proc-name { font-size: 1.2rem; font-weight: 700; color: #f1f5f9; }
.proc-desc { font-size: 0.78rem; color: #64748b; margin-top: 2px; }

.special-kpi-row {
  display: flex; gap: 12px; flex-wrap: wrap;
}
.special-kpi-item {
  background: #141720; border: 1px solid #2d3449;
  border-radius: 10px; padding: 12px 20px;
  flex: 1; min-width: 140px;
}
.spi-label { font-size: 0.72rem; color: #64748b; margin-bottom: 4px; }
.spi-value { font-size: 1.1rem; font-weight: 700; color: #f1f5f9; }

/* ===== 연결 설정 ===== */
.setup-container { max-width: 820px; }
.setup-title {
  font-size: 1.3rem; font-weight: 700; color: #f1f5f9;
  margin-bottom: 8px; display: flex; align-items: center; gap: 10px;
}
.setup-desc { color: #64748b; font-size: 0.85rem; line-height: 1.7; margin-bottom: 24px; }

.setup-status-box {
  display: flex; align-items: center; gap: 14px;
  background: #1e2130; border: 1px solid #2d3449;
  border-radius: 10px; padding: 16px 20px; margin-bottom: 20px;
}
.setup-status-box.connected { border-color: #10b981; background: rgba(16,185,129,0.08); }
.setup-status-icon { font-size: 1.8rem; color: #ef4444; }
.setup-status-box.connected .setup-status-icon { color: #10b981; }
.setup-status-title { font-weight: 700; color: #e2e8f0; margin-bottom: 2px; }
.setup-status-sub { font-size: 0.78rem; color: #64748b; }

.setup-step {
  background: #1e2130; border: 1px solid #2d3449;
  border-radius: 10px; padding: 20px;
  margin-bottom: 14px; display: flex; gap: 18px;
}
.setup-step.success { border-color: rgba(16,185,129,0.4); }
.step-number {
  background: #6366f1; color: #fff;
  border-radius: 50%; width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem; flex-shrink: 0;
  align-self: flex-start;
}
.step-number.done { background: #10b981; }
.step-content h3 { font-size: 0.95rem; font-weight: 700; color: #e2e8f0; margin-bottom: 8px; }
.step-content p { font-size: 0.82rem; color: #94a3b8; line-height: 1.65; margin-bottom: 6px; }
.step-content code {
  background: #141720; border-radius: 4px;
  padding: 2px 6px; font-size: 0.78rem; color: #e2e8f0;
}
.step-img-tip {
  background: rgba(99,102,241,0.08); border-left: 3px solid #6366f1;
  border-radius: 6px; padding: 10px 14px; margin: 10px 0;
  font-size: 0.8rem; color: #94a3b8; line-height: 1.6;
}
.step-img-tip i { color: #818cf8; margin-right: 4px; }

.url-input-row { display: flex; gap: 10px; margin: 12px 0; }
.url-input-row input {
  flex: 1; background: #141720; border: 1px solid #2d3449;
  color: #e2e8f0; border-radius: 8px; padding: 9px 14px; font-size: 0.83rem;
}
.url-input-row input:focus { outline: none; border-color: #6366f1; }
.connect-btn {
  background: #6366f1; border: none; color: #fff;
  border-radius: 8px; padding: 9px 18px;
  font-size: 0.83rem; font-weight: 600; cursor: pointer;
  white-space: nowrap; display: flex; align-items: center; gap: 6px;
}
.connect-btn:hover { background: #4f46e5; }
.connect-result {
  font-size: 0.8rem; margin-top: 6px; padding: 8px 12px;
  border-radius: 6px; display: none;
}
.connect-result.success { background: rgba(16,185,129,0.1); color: #34d399; display: block; }
.connect-result.error { background: rgba(239,68,68,0.1); color: #f87171; display: block; }
.connect-result.info { background: rgba(99,102,241,0.1); color: #818cf8; display: block; }

.interval-btns { display: flex; gap: 8px; margin: 10px 0; }
.interval-btn {
  background: #141720; border: 1px solid #2d3449;
  color: #94a3b8; border-radius: 6px;
  padding: 7px 16px; font-size: 0.82rem; cursor: pointer;
}
.interval-btn.active { background: #6366f1; border-color: #6366f1; color: #fff; font-weight: 600; }
.interval-note { font-size: 0.78rem; color: #64748b; }

.target-input-table {
  width: 100%; border-collapse: collapse; font-size: 0.8rem;
  margin: 10px 0;
}
.target-input-table th {
  background: #141720; color: #64748b; padding: 8px 12px;
  text-align: left; border-bottom: 1px solid #2d3449;
}
.target-input-table td {
  padding: 6px 12px; border-bottom: 1px solid #1e2435;
  color: #94a3b8;
}
.target-input {
  background: #141720; border: 1px solid #2d3449;
  color: #e2e8f0; border-radius: 6px; padding: 5px 10px;
  font-size: 0.8rem; width: 140px;
}
.target-input:focus { outline: none; border-color: #6366f1; }

.badge-connected {
  display: inline-block; background: rgba(16,185,129,0.15);
  color: #34d399; border-radius: 20px; padding: 2px 10px; font-size: 0.78rem;
}

/* ===== 플로팅 버튼 ===== */
.fab-help {
  position: fixed; right: 24px; bottom: 24px;
  width: 48px; height: 48px; border-radius: 50%;
  background: #6366f1; border: none; color: #fff;
  font-size: 1.1rem; cursor: pointer; z-index: 200;
  box-shadow: 0 4px 16px rgba(99,102,241,0.4);
  transition: transform 0.15s;
}
.fab-help:hover { transform: scale(1.1); }

/* ===== 상태 색상 도우미 ===== */
.text-green { color: #34d399; }
.text-red { color: #f87171; }
.text-orange { color: #fbbf24; }
.text-blue { color: #818cf8; }
.text-gray { color: #64748b; }
.fw-bold { font-weight: 700; }

/* ===== 데모 배너 ===== */
#demo-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 9000;
  background: linear-gradient(90deg, #92400e, #b45309);
  color: #fef3c7;
  font-size: 0.82rem;
  padding: 9px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
#demo-banner i { color: #fcd34d; }

/* 데모 배너 표시 중일 때 본문 아래로 밀기 */
body.demo-mode #sidebar,
body.demo-mode #main-content {
  margin-top: 38px;
}
body.demo-mode #sidebar {
  height: calc(100vh - 38px);
  top: 38px;
}
body.demo-mode .top-header {
  top: 38px;
}

/* ===== 스크롤바 ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #0f1117; }
::-webkit-scrollbar-thumb { background: #2d3449; border-radius: 3px; }

/* ===== 포장 공정 전용 뷰 ===== */
.pack-target-row {
  display: flex; align-items: flex-end; gap: 20px; flex-wrap: wrap;
}
.pack-target-item {
  display: flex; flex-direction: column; gap: 5px;
}
.pack-target-label {
  font-size: 0.78rem; color: #94a3b8; display: flex; align-items: center; gap: 6px;
}
.pack-target-label i { color: #6366f1; }
.pack-target-input {
  background: #1a2035; border: 1px solid #2d3449; color: #e2e8f0;
  border-radius: 8px; padding: 8px 12px; font-size: 0.95rem; width: 160px;
  font-family: inherit;
}
.pack-target-input:focus { outline: none; border-color: #6366f1; }
.pack-target-unit { font-size: 0.75rem; color: #64748b; }
.pack-target-save-btn {
  background: #6366f1; color: #fff; border: none; border-radius: 8px;
  padding: 9px 20px; font-size: 0.85rem; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: background 0.2s; align-self: flex-end;
}
.pack-target-save-btn:hover { background: #4f46e5; }

.pack-achieve-list { display: flex; flex-direction: column; gap: 16px; padding: 4px 0; }
.pack-achieve-item {}
.pack-achieve-label { font-size: 0.78rem; color: #94a3b8; margin-bottom: 6px; }
.pack-achieve-bar-wrap {
  background: #1a2035; border-radius: 6px; height: 10px; overflow: hidden; margin-bottom: 4px;
}
.pack-achieve-bar {
  height: 100%; background: linear-gradient(90deg, #6366f1, #818cf8);
  border-radius: 6px; transition: width 0.5s ease; max-width: 100%;
}
.pack-achieve-bar.green { background: linear-gradient(90deg, #10b981, #34d399); }
.pack-achieve-bar.red   { background: linear-gradient(90deg, #ef4444, #f87171); }
.pack-achieve-pct { font-size: 0.82rem; color: #e2e8f0; font-weight: 600; }

.pack-data-table td:first-child { color: #94a3b8; font-size: 0.8rem; }
.pack-data-table td:last-child  { font-weight: 600; text-align: right; font-size: 0.9rem; }
.pack-data-table tr:hover td    { background: rgba(99,102,241,0.06); }

/* ===== 품질 대시보드 ===== */
.quality-sub-tabs {
  display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap;
}
.quality-sub-tab {
  background: #1a2035; border: 1px solid #2d3449; color: #94a3b8;
  border-radius: 8px; padding: 9px 22px; font-size: 0.88rem; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: all 0.2s;
  display: flex; align-items: center; gap: 7px;
}
.quality-sub-tab:hover { border-color: #6366f1; color: #e2e8f0; }
.quality-sub-tab.active {
  background: #6366f1; border-color: #6366f1; color: #fff;
}
.quality-sub-panel {}
.quality-panel-header { margin-bottom: 20px; }
.quality-panel-title { font-size: 1.15rem; font-weight: 700; color: #e2e8f0; }
.quality-panel-sub   { font-size: 0.78rem; color: #64748b; margin-top: 4px; }

/* ===== 품질 대시보드 헤더탭 ===== */
#quality-header-tabs {
  display: none; align-items: center; gap: 4px; margin-left: 12px;
}
.quality-header-tab {
  background: rgba(255,255,255,0.06); border: 1px solid #2d3449;
  color: #94a3b8; border-radius: 6px; padding: 5px 14px;
  font-size: 0.8rem; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: all 0.18s;
  display: flex; align-items: center; gap: 6px;
}
.quality-header-tab:hover { border-color: #6366f1; color: #e2e8f0; }
.quality-header-tab.active {
  background: #6366f1; border-color: #6366f1; color: #fff;
}

/* ===== 기간 필터 탭 (품질 패널 내) ===== */
.qperiod-tabs {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 20px; flex-wrap: wrap;
  background: #141a2e; border: 1px solid #1e2a45;
  border-radius: 10px; padding: 8px 12px;
}
.qperiod-label {
  font-size: 0.75rem; font-weight: 700; color: #475569;
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-right: 4px; white-space: nowrap;
}
.qperiod-tab {
  background: transparent; border: 1px solid #2d3449;
  color: #94a3b8; border-radius: 6px; padding: 5px 14px;
  font-size: 0.8rem; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: all 0.18s;
}
.qperiod-tab:hover { border-color: #6366f1; color: #e2e8f0; background: rgba(99,102,241,0.08); }
.qperiod-tab.active { background: #6366f1; border-color: #6366f1; color: #fff; }
.qperiod-sheet-btn {
  margin-left: auto; background: rgba(16,185,129,0.12);
  border: 1px solid rgba(16,185,129,0.35); color: #10b981;
  border-radius: 6px; padding: 5px 14px;
  font-size: 0.78rem; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: all 0.18s;
  display: flex; align-items: center; gap: 6px; white-space: nowrap;
}
.qperiod-sheet-btn:hover { background: rgba(16,185,129,0.22); border-color: #10b981; }

/* ===== Q-Cost 섹션 ===== */
.qcost-section {
  background: linear-gradient(135deg, rgba(99,102,241,0.04) 0%, rgba(239,68,68,0.04) 100%);
  border: 1px solid #1e2a45; border-radius: 12px;
  padding: 20px; margin-bottom: 20px;
}
.qcost-section-title {
  font-size: 1rem; font-weight: 700; color: #e2e8f0;
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 16px; padding-bottom: 12px;
  border-bottom: 1px solid #1e2a45;
}
.qcost-section-title i { color: #f59e0b; }
.qcost-section-title .section-sub {
  font-size: 0.75rem; font-weight: 400; color: #64748b; margin-left: 4px;
}

/* ===== 검사 심층분석 섹션 ===== */
.deep-section {
  background: linear-gradient(135deg, rgba(16,185,129,0.04) 0%, rgba(99,102,241,0.04) 100%);
  border: 1px solid #1e2a45; border-radius: 12px;
  padding: 20px; margin-top: 20px;
}
.deep-section .qcost-section-title i { color: #10b981; }

/* ===== 차트 Expand 버튼 ===== */
.chart-title {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.chart-expand-btn {
  margin-left: auto;
  background: rgba(99,102,241,0.1);
  border: 1px solid rgba(99,102,241,0.25);
  color: #94a3b8;
  border-radius: 5px;
  padding: 3px 8px;
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.18s;
  flex-shrink: 0;
}
.chart-expand-btn:hover {
  background: rgba(99,102,241,0.25);
  border-color: #6366f1;
  color: #818cf8;
}

/* ===== 차트 팝업 모달 ===== */
.chart-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 8000;
  background: rgba(0,0,0,0.75);
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.chart-modal-overlay.active { display: flex; }
.chart-modal-box {
  background: #1a2035;
  border: 1px solid #2d3449;
  border-radius: 14px;
  width: min(1100px, 95vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0,0,0,0.6);
}
.chart-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #2d3449;
  flex-shrink: 0;
}
.chart-modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: #e2e8f0;
}
.chart-modal-close {
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.3);
  color: #ef4444;
  border-radius: 6px;
  width: 32px; height: 32px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem;
  transition: all 0.15s;
}
.chart-modal-close:hover { background: rgba(239,68,68,0.25); }
.chart-modal-body {
  flex: 1;
  padding: 20px;
  min-height: 0;
  position: relative;
}
.chart-modal-body canvas {
  width: 100% !important;
  height: 100% !important;
  min-height: 420px;
}
