:root {
  --bg-base: #0b0f19;
  --bg-surface: #111827;
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-card-hover: rgba(51, 65, 85, 0.8);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(56, 189, 248, 0.3);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-sub: #64748b;
  --accent-blue: #38bdf8;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  --accent-purple: #a855f7;
  --accent-amber: #f59e0b;
}

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

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-base);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 헤더 */
header {
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.95) 0%, rgba(11, 15, 25, 0.8) 100%);
  border-bottom: 1px solid var(--border-color);
  padding: 24px 32px;
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.logo-area h1 {
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(135deg, #38bdf8 0%, #818cf8 50%, #c084fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-area p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* 탭 내비게이션 */
.nav-tabs {
  display: flex;
  gap: 8px;
  background: rgba(15, 23, 42, 0.6);
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  color: #0b0f19;
  background: var(--accent-blue);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.4);
}

/* 메인 컨테이너 */
main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 32px 24px 64px 24px;
  width: 100%;
  flex: 1;
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* KPI 요약 카드 그리드 */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 22px;
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

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

.kpi-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.kpi-value {
  font-size: 28px;
  font-weight: 800;
  margin: 10px 0 6px 0;
  font-family: 'Outfit', sans-serif;
}

.kpi-desc {
  font-size: 12px;
  color: var(--text-sub);
}

/* 그리드 레이아웃 */
.grid-2 {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 24px;
  margin-bottom: 28px;
}

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

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  backdrop-filter: blur(10px);
}

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

.card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 컨트롤 (검색, 필터) */
.controls-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

input[type="text"], select {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease;
}

input[type="text"]:focus, select:focus {
  border-color: var(--accent-blue);
}

.pill-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

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

.pill-btn.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

/* 테이블 */
.table-container {
  overflow-x: auto;
  max-height: 520px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

th {
  background: rgba(15, 23, 42, 0.95);
  color: var(--text-muted);
  font-weight: 600;
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border-color);
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-main);
}

tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

/* 배지 */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.badge-superhub {
  background: rgba(244, 63, 94, 0.15);
  color: #fda4af;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.badge-potential {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-niche {
  background: rgba(168, 85, 247, 0.15);
  color: #d8b4fe;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.badge-balanced {
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.badge-low {
  background: rgba(71, 85, 105, 0.2);
  color: #94a3b8;
  border: 1px solid rgba(71, 85, 105, 0.3);
}

/* 진단실 상세 카드 */
.diag-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

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

.gauge-container {
  margin: 20px 0;
}

.gauge-bar {
  height: 12px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.gauge-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 14px;
}

.stat-row span:first-child { color: var(--text-muted); }
.stat-row span:last-child { font-weight: 600; }

/* 갤러리 */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 24px;
}

.gallery-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
}

.gallery-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-blue);
}

.gallery-img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  background: #1e293b;
  border-bottom: 1px solid var(--border-color);
}

.gallery-info {
  padding: 16px;
}

.gallery-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
}

.gallery-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* 모달 */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.active { display: flex; }

.modal-content {
  max-width: 90%;
  max-height: 90%;
  position: relative;
}

.modal-content img {
  max-width: 100%;
  max-height: 85vh;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.modal-close {
  position: absolute;
  top: -40px;
  right: 0;
  color: white;
  font-size: 30px;
  cursor: pointer;
}

/* 공식 가이드 박스 */
.formula-box {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-accent);
  border-radius: 14px;
  padding: 24px;
  margin: 20px 0;
  font-family: 'Outfit', monospace;
  font-size: 16px;
  color: #38bdf8;
  overflow-x: auto;
  line-height: 1.8;
}

.action-btn {
  background: var(--accent-blue);
  color: #0b0f19;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
}

.action-btn:hover { opacity: 0.9; }

footer {
  border-top: 1px solid var(--border-color);
  padding: 24px;
  text-align: center;
  font-size: 12px;
  color: var(--text-sub);
  background: var(--bg-surface);
}
