/* ==========================================================================
   JANG MART BI 대시보드 - 다크/라이트 테마 & 직관적 실적 중심 디자인 시스템
   ========================================================================== */

:root {
  --bg-app: #0b0f17;
  --bg-sidebar: #0f1523;
  --bg-card: #151d30;
  --bg-card-hover: #1c263f;
  --border-color: #222f4c;
  --text-main: #f1f5f9;
  --text-sub: #94a3b8;
  --text-muted: #64748b;

  --accent-blue: #3b82f6;
  --accent-orange: #f97316;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-purple: #8b5cf6;

  --sidebar-w: 240px;
}

body.theme-light {
  --bg-app: #ffffff;
  --bg-sidebar: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --border-color: #e2e8f0;
  --text-main: #0f172a;
  --text-sub: #334155;
  --text-muted: #64748b;
}

body.theme-light .spark-kpi-card,
body.theme-light .chart-card {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
}

body.theme-light .alert-banner {
  background: #fef2f2;
  border-color: #fecaca;
}

body.theme-light .alert-text strong {
  color: #dc2626;
}

body.theme-light .alert-badge {
  background: #fee2e2;
  color: #991b1b;
}

body.theme-light .legend-chip {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #334155;
}

body.theme-light .legend-chip.active {
  background: #e2e8f0;
  color: #0f172a;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* App Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Left Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 16px;
  flex-shrink: 0;
  z-index: 10;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.brand-icon {
  font-size: 26px;
  width: 44px;
  height: 44px;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}

.brand-text h2 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

.brand-text span {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-blue);
  letter-spacing: 0.8px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-sub);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
}

body.theme-light .nav-item:hover {
  background: rgba(0, 0, 0, 0.03);
}

.nav-item.active {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.35);
  color: var(--accent-blue);
}

.nav-icon {
  font-size: 17px;
}

/* Sidebar Filter */
.sidebar-filter-section {
  padding: 16px;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  margin-bottom: 16px;
}

body.theme-light .sidebar-filter-section {
  background: #f8fafc;
}

.filter-title {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.sidebar-select {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  outline: none;
}

.filter-tip {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.4;
}

.sidebar-footer {
  font-size: 11px;
  color: var(--text-muted);
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

/* Main Content Area */
.main-content {
  flex: 1;
  padding: 30px 36px;
  overflow-y: auto;
  max-width: 1400px;
}

/* Top Header */
.top-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.top-header h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-main);
}

.top-header .desc {
  font-size: 13px;
  color: var(--text-sub);
  margin-top: 4px;
}

/* Theme Switcher */
.theme-switch {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 3px;
}

.theme-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.theme-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

body.theme-light .theme-btn.active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Alert Banner */
.alert-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  padding: 12px 18px;
  border-radius: 10px;
  margin-bottom: 24px;
}

.alert-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.alert-icon {
  font-size: 20px;
}

.alert-text {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.alert-text strong {
  color: #f87171;
  font-weight: 700;
}

.alert-text span {
  color: var(--text-sub);
}

.alert-text b.neg {
  color: #f87171;
  font-weight: 700;
}

.alert-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 10px;
  border-radius: 6px;
}

/* Chart Card & Layouts */
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 22px 24px;
  margin-bottom: 24px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.header-text h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

.header-text p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Period switches */
.legend-switches {
  display: flex;
  gap: 8px;
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-sub);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.legend-chip.active {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}

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

.dot-all { background: var(--accent-blue); }
.dot-m6 { background: var(--accent-orange); }
.dot-m3 { background: var(--accent-green); }

/* Sparkline KPI Grid */
.kpi-grid-sparkline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.spark-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px 16px 12px 16px;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, border-color 0.2s;
}

.spark-kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-blue);
}

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.kpi-value-row {
  margin: 6px 0;
}

.kpi-num {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-main);
}

.kpi-num .unit {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
  margin-left: 2px;
}

.kpi-change {
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 12px;
}

.kpi-change span {
  font-weight: 500;
  color: var(--text-muted);
}

.kpi-change.up { color: #10b981; }
.kpi-change.down { color: #10b981; }
.kpi-change.warn { color: #ef4444; }

.spark-box {
  width: 100%;
  height: 38px;
  margin-top: auto;
}

.sparkline {
  width: 100% !important;
  height: 100% !important;
}

/* 2 Column Layout */
.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 1080px) {
  .grid-2col {
    grid-template-columns: 1fr;
  }
}

/* Dark Table */
.table-wrap-dark {
  overflow-x: auto;
}

.dark-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.dark-table th {
  text-align: left;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
}

.dark-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
}

.badge-store {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}

.badge-store.off { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.badge-store.on { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }

/* Bundle Recommendations */
.bundle-recommendations {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bundle-card {
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.bundle-left h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.bundle-left p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.bundle-stat {
  text-align: right;
}

.bundle-stat .count {
  font-size: 16px;
  font-weight: 800;
  color: var(--accent-orange);
}

.bundle-stat .lift {
  font-size: 11px;
  color: var(--text-sub);
}

/* Chart Takeaway Note (그래프별 1~2줄 유의미한 결론) */
.chart-takeaway {
  margin-top: 14px;
  padding: 10px 14px;
  background: rgba(59, 130, 246, 0.06);
  border-left: 3px solid var(--accent-blue);
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-sub);
  line-height: 1.5;
}

.chart-takeaway strong {
  color: var(--text-main);
  font-weight: 700;
}

body.theme-light .chart-takeaway {
  background: #f8fafc;
  border-left-color: #2563eb;
  color: #334155;
}

/* Page Executive Insight Card (해당 페이지 최하단 종합 비즈니스 인사이트) */
.page-insight-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px 24px;
  margin-top: 8px;
  margin-bottom: 24px;
  border-left: 4px solid var(--accent-orange);
}

body.theme-light .page-insight-card {
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.page-insight-card .insight-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.page-insight-card .insight-tag {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(234, 88, 12, 0.12);
  color: #ea580c;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.page-insight-card h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.page-insight-card .insight-body {
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.6;
}

.page-insight-card .insight-action {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-color);
  font-size: 12px;
  color: var(--accent-blue);
  font-weight: 600;
}

/* Highlight Navigation Item */
.nav-item.highlight-nav {
  color: #ea580c;
  background: rgba(234, 88, 12, 0.08);
  border: 1px solid rgba(234, 88, 12, 0.25);
  margin-top: 6px;
}

.nav-item.highlight-nav:hover,
.nav-item.highlight-nav.active {
  background: rgba(234, 88, 12, 0.16);
  border-color: #ea580c;
  color: #ea580c;
}

/* Strategic Vision Tree (경영보고서 스타일 마인드맵/조직도) */
.strategy-tree {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0;
}

.tree-tier {
  width: 100%;
}

.tree-connector-v {
  width: 2px;
  height: 24px;
  background: var(--border-color);
  margin: 0 auto;
  position: relative;
}

.tree-connector-v::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: -3px;
  width: 8px;
  height: 8px;
  background: var(--border-color);
  border-radius: 50%;
}

/* Tier 1: Mission Root */
.tier-mission .node-root {
  max-width: 720px;
  margin: 0 auto;
  background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 100%);
  color: #ffffff;
  padding: 22px 28px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
}

.node-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.node-root h3 {
  font-size: 19px;
  font-weight: 800;
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}

.node-root p {
  font-size: 13px;
  color: #e0e7ff;
}

/* Tier 2: 3 Pillars */
.tier-pillars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 900px) {
  .tier-pillars {
    grid-template-columns: 1fr;
  }
}

.node-pillar {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 18px;
  transition: transform 0.2s;
}

body.theme-dark .node-pillar {
  background: rgba(255, 255, 255, 0.03);
}

.pillar-omni { border-top: 4px solid var(--accent-blue); }
.pillar-hub { border-top: 4px solid #0284c7; }
.pillar-growth { border-top: 4px solid var(--accent-orange); }

.pillar-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.node-pillar h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 10px;
  line-height: 1.4;
}

.evidence-box {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 11px;
  color: var(--text-sub);
  line-height: 1.5;
}

body.theme-dark .evidence-box {
  background: rgba(0, 0, 0, 0.2);
}

.evidence-box strong {
  color: #ea580c;
}

/* Tier 3: Initiatives */
.tier-initiatives {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 900px) {
  .tier-initiatives {
    grid-template-columns: 1fr;
  }
}

.initiative-card {
  background: #ffffff;
  border: 1px dashed var(--border-color);
  border-radius: 8px;
  padding: 14px;
}

body.theme-dark .initiative-card {
  background: rgba(255, 255, 255, 0.02);
}

.init-header {
  font-size: 10px;
  font-weight: 800;
  color: var(--accent-blue);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.initiative-card h5 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.initiative-card p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Roadmap Timelines */
.roadmap-timeline {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.timeline-item {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
}

.timeline-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.time-badge {
  font-size: 12px;
  font-weight: 800;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
}

.time-badge.q1 { background: #dbeafe; color: #1d4ed8; }
.time-badge.q2 { background: #fed7aa; color: #c2410c; }
.time-badge.q3 { background: #dcfce7; color: #15803d; }
.time-badge.q4 { background: #f3e8ff; color: #7e22ce; }
.time-badge.year { background: #f1f5f9; color: #0f172a; border: 1px solid #cbd5e1; }

body.theme-dark .time-badge.year {
  background: rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
  border-color: rgba(255, 255, 255, 0.2);
}

.time-content h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.time-content p {
  font-size: 12px;
  color: var(--text-sub);
  line-height: 1.4;
  margin-bottom: 6px;
}

.time-content ul {
  padding-left: 18px;
  font-size: 12px;
  color: var(--text-sub);
  margin-bottom: 6px;
}

.time-content li {
  margin-bottom: 3px;
}

.metric-proof {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: #ea580c;
  background: rgba(234, 88, 12, 0.08);
  padding: 3px 8px;
  border-radius: 4px;
}

/* Security Access Gate Modal (잠금 화면 스타일) */
.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(135deg, #0b0f17 0%, #1e293b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

body.theme-light .auth-overlay {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
}

.auth-modal {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border-radius: 16px;
  padding: 36px 30px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(0, 0, 0, 0.08);
  animation: modalPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  0% { transform: scale(0.92); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.auth-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.auth-modal h2 {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.3px;
  margin-bottom: 8px;
}

.auth-desc {
  font-size: 13px;
  color: #64748b;
  line-height: 1.5;
  margin-bottom: 24px;
}

.auth-form .input-wrap {
  display: flex;
  gap: 8px;
}

.auth-form input[type="password"] {
  flex: 1;
  padding: 12px 14px;
  border: 2px solid #cbd5e1;
  border-radius: 8px;
  font-size: 16px;
  letter-spacing: 4px;
  text-align: center;
  color: #0f172a;
  outline: none;
  transition: border-color 0.2s;
}

.auth-form input[type="password"]:focus {
  border-color: #2563eb;
}

.btn-auth {
  padding: 12px 20px;
  background: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.btn-auth:hover {
  background: #1d4ed8;
}

.auth-error {
  font-size: 12px;
  color: #dc2626;
  font-weight: 600;
  margin-top: 10px;
}

.auth-footer {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #f1f5f9;
  font-size: 11px;
  color: #94a3b8;
}


