:root {
    --primary: #1e40af;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --bg: #f1f5f9;
    --card: #ffffff;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
}

body {
    font-family: 'Pretendard', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    margin: 0; padding: 20px;
}

.container { max-width: 1600px; margin: 0 auto; }

header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px; padding-bottom: 10px; border-bottom: 1px solid var(--border);
}

h1 { margin: 0; font-size: 1.3rem; font-weight: 800; letter-spacing: -0.02em; }
header p { margin: 2px 0 0; color: var(--text-muted); font-size: 0.8rem; }

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

/* KPI 그리드 - 가로 1열 배치 */
.kpi-grid {
    display: flex; gap: 10px; margin-bottom: 25px; align-items: stretch;
}

.kpi-card {
    background: var(--card); border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05); display: flex; flex-direction: column;
    justify-content: center; align-items: center; text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 4px 6px rgba(0,0,0,0.1); }

/* 앞의 4개 (작은 카드) */
.kpi-card.mini {
    flex: 0.7; /* 너비 비중 작게 */
    padding: 10px 15px;
}
.kpi-card.mini .label { font-size: 0.7rem; color: var(--text-muted); font-weight: 600; }
.kpi-card.mini h3 { margin: 2px 0 0; font-size: 1.1rem; color: #334155; }

/* 뒤의 4개 (큰 카드) */
.kpi-card.highlight {
    flex: 1.3; /* 너비 비중 크게 */
    padding: 15px 20px; background: #ffffff;
    min-width: 140px; /* 크기 유지 및 통일 */
}
.kpi-card.highlight.grey { background: #f8fafc; }
.kpi-card.highlight.blue { background: #f0f4ff; }
.kpi-card.highlight.green { background: #f0fdf4; }
.kpi-card.highlight.orange { background: #fffbeb; }

.kpi-card.highlight .label { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); margin-bottom: 4px; }
.kpi-card.highlight h2 { margin: 0; font-size: 1.6rem; color: #1e293b; letter-spacing: -0.04em; font-weight: 800; }

/* 분석 그리드 */
.analysis-grid {
    background: var(--card); border-radius: 12px; padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1); margin-bottom: 25px;
}

.chart-header-row {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px; border-bottom: 1px solid var(--border); padding-bottom: 10px;
}

.unit-toggle-inline { display: flex; background: #f1f5f9; padding: 4px; border-radius: 8px; }
.unit-toggle-inline button {
    border: none; padding: 6px 16px; font-size: 0.8rem; border-radius: 6px; cursor: pointer;
    font-weight: 600; background: transparent; color: var(--text-muted); transition: 0.2s;
}
.unit-toggle-inline button.active { background: white; color: var(--primary); box-shadow: 0 1px 2px rgba(0,0,0,0.1); }

.charts-container { display: grid; grid-template-columns: 1fr 1fr; gap: 25px; }
.chart-box { 
    min-height: 260px; display: flex; flex-direction: column; 
    animation: fadeIn 0.6s ease-out forwards;
}
.chart-box h4 { margin: 0 0 12px; font-size: 0.9rem; color: var(--text-muted); border-left: 3px solid #cbd5e1; padding-left: 10px; }
.canvas-wrapper { flex: 1; position: relative; height: 220px; }

/* 필터바 */
.filter-bar {
    display: flex; justify-content: space-between; align-items: center;
    gap: 12px; margin-bottom: 15px; background: #f8fafc; padding: 10px; border-radius: 8px; border: 1px solid var(--border);
}
.filter-group { display: flex; gap: 8px; flex: 1; }
.filter-group select { padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.75rem; background: white; min-width: 120px; }
.tool-group { display: flex; gap: 8px; align-items: center; }
#modelSearch { padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.75rem; width: 200px; }

.table-section { background: var(--card); border-radius: 12px; padding: 15px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.table-wrapper { overflow-x: auto; max-height: 450px; }
table { width: 100%; border-collapse: collapse; font-size: 0.75rem; }
th { background: #f8fafc; padding: 10px; text-align: left; position: sticky; top: 0; z-index: 10; border-bottom: 2px solid var(--border); font-weight: 700; }
td { padding: 8px 10px; border-bottom: 1px solid var(--border); }

/* 드롭존 및 초기화면 */
.empty-state {
    display: flex; justify-content: center; align-items: center;
    height: 60vh; background: white; border: 2px dashed #cbd5e1;
    border-radius: 16px; margin-top: 20px; text-align: center;
    transition: all 0.3s;
}
.empty-state.drag-over {
    border-color: var(--primary); background: #f0f4ff; transform: scale(1.01);
}
.empty-content i { color: var(--text-muted); margin-bottom: 20px; }
.empty-content h2 { margin: 0 0 10px; font-size: 1.5rem; color: #1e293b; }
.empty-content p { color: var(--text-muted); margin: 5px 0; }
.empty-content .sub-text { font-size: 0.8rem; color: #94a3b8; margin-top: 15px; }

/* 컨테이너 드롭존 활성화 시 스타일 */
#dropZone.drag-over {
    box-shadow: 0 0 0 4px rgba(30, 64, 175, 0.2); border-radius: 8px;
}

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

#tableBody tr {
    animation: fadeIn 0.3s ease-out forwards;
}

.status-tag { padding: 2px 6px; border-radius: 4px; font-weight: 700; font-size: 0.65rem; transition: all 0.2s ease; }
.status-tag:hover { filter: brightness(0.95); transform: scale(1.05); }

.status-new { background: #fee2e2; color: #991b1b; }
.status-common { background: #dcfce7; color: #166534; }
.btn-primary { background: var(--primary); color: white; border: none; padding: 7px 14px; border-radius: 6px; cursor: pointer; display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 0.8rem; }
.btn-secondary { background: white; border: 1px solid var(--border); padding: 7px 14px; border-radius: 6px; cursor: pointer; display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 0.8rem; }
