/* ========================================
   전역 스타일 및 리셋
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 색상 팔레트 */
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #06b6d4;
    
    /* 배경 및 텍스트 */
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    
    /* 경계선 */
    --border-color: #e5e7eb;
    --border-radius: 12px;
    
    /* 그림자 */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    /* 폰트 */
    --font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ========================================
   헤더
   ======================================== */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 28px 30px;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.header-content {
    text-align: left;
    flex: 1;
}

/* 헤더 우측 액션 영역 */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* DB 연결 상태 표시 */
.db-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: rgba(255,255,255,0.85);
    white-space: nowrap;
}
.db-status #dbStatusIcon { font-size: 0.65rem; color: #94a3b8; transition: color 0.3s; }

/* ========================================
   헤더 버튼 — 통일 스타일 (btn-header)
   모든 헤더 버튼은 이 단일 클래스 사용
   아이콘 색상만 --btn-accent 변수로 개별 지정
   ======================================== */
.btn-header {
    display:         inline-flex;
    align-items:     center;
    gap:             6px;
    padding:         7px 15px;
    border-radius:   8px;
    border:          1.5px solid rgba(255,255,255,0.35);
    background:      rgba(255,255,255,0.10);
    color:           rgba(255,255,255,0.92);
    font-size:       0.84rem;
    font-weight:     500;
    font-family:     inherit;
    cursor:          pointer;
    white-space:     nowrap;
    text-decoration: none;
    transition:      background 0.18s, border-color 0.18s, box-shadow 0.18s;
    line-height:     1;
}
.btn-header:hover {
    background:    rgba(255,255,255,0.20);
    border-color:  rgba(255,255,255,0.65);
    color:         #fff;
    box-shadow:    0 2px 10px rgba(0,0,0,0.18);
}
.btn-header:active {
    background:    rgba(255,255,255,0.28);
    box-shadow:    none;
}

/* 아이콘 기본 — 버튼 텍스트와 같은 흰색 반투명 */
.btn-header i {
    font-size: 0.82rem;
    opacity: 0.85;
    transition: opacity 0.15s;
}
.btn-header:hover i { opacity: 1; }

/* ── 버튼별 아이콘 색상 포인트 ── */
/* 대시보드 — 노란색 */
.btn-header.btn-dashboard i { color: #fde047; }
.btn-header.btn-dashboard { border-color: rgba(253,224,71,0.40); }
.btn-header.btn-dashboard:hover { border-color: rgba(253,224,71,0.75); background: rgba(253,224,71,0.12); }

/* DB 설정 — 초록색 */
.btn-header.btn-db i { color: #4ade80; }
.btn-header.btn-db { border-color: rgba(74,222,128,0.40); }
.btn-header.btn-db:hover { border-color: rgba(74,222,128,0.75); background: rgba(74,222,128,0.12); }

/* 새로고침 — 하늘색 */
.btn-header.btn-reset i { color: #7dd3fc; }
.btn-header.btn-reset { border-color: rgba(125,211,252,0.35); }
.btn-header.btn-reset:hover { border-color: rgba(125,211,252,0.65); background: rgba(125,211,252,0.12); }

/* 진단 이력 — 보라색 */
.btn-header.btn-history i { color: #c4b5fd; }
.btn-header.btn-history { border-color: rgba(196,181,253,0.35); }
.btn-header.btn-history:hover { border-color: rgba(196,181,253,0.65); background: rgba(196,181,253,0.12); }

/* 진단기준 설정 — 오렌지색 (강조) */
.btn-header.btn-criteria {
    border-color: rgba(251,146,60,0.55);
    background:   rgba(251,146,60,0.13);
    position: relative;
}
.btn-header.btn-criteria i { color: #fb923c; }
.btn-header.btn-criteria:hover {
    border-color: rgba(251,146,60,0.85);
    background:   rgba(251,146,60,0.22);
    box-shadow:   0 2px 14px rgba(251,146,60,0.30);
}
/* 기준관리 배지 */
.btn-criteria-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    background: rgba(251,146,60,0.85);
    color: #fff;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.4;
    margin-left: 2px;
}

/* 기존 클래스 — 하위 호환 유지 (삭제하면 다른 페이지 깨질 수 있음) */
.btn-outline-history {
    background: rgba(255,255,255,0.12);
    border: 1.5px solid rgba(255,255,255,0.45);
    color: white;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 7px;
    transition: background 0.2s, border-color 0.2s;
    white-space: nowrap;
}
.btn-outline-history:hover {
    background: rgba(255,255,255,0.22);
    border-color: rgba(255,255,255,0.75);
}
.btn-outline-dashboard {
    background: rgba(250,204,21,0.15);
    border: 1.5px solid rgba(250,204,21,0.55);
    color: #fef08a;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 7px;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    white-space: nowrap;
}
.btn-outline-dashboard:hover {
    background: rgba(250,204,21,0.28);
    border-color: rgba(250,204,21,0.85);
    color: #fefce8;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.logo i {
    font-size: 2.5rem;
}

.logo h1 {
    font-size: 2rem;
    font-weight: 700;
}

.subtitle {
    font-size: 1rem;
    opacity: 0.9;
    font-weight: 300;
}

/* ========================================
   카드 컴포넌트
   ======================================== */
.card {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    margin-bottom: 30px;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    background: var(--bg-secondary);
    padding: 20px 30px;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.card-header.report-header {
    justify-content: space-between;
}

.card-header i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.card-header h2 {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 16px 24px 20px;
}

/* ========================================
   업로드 영역
   ======================================== */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 22px 30px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: var(--bg-secondary);
}

.upload-area.drag-over {
    border-color: var(--primary-color);
    background: var(--bg-secondary);
    transform: scale(1.02);
}

.upload-area i {
    font-size: 2.4rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.upload-text {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.upload-hint {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 14px;
}

/* ========================================
   파일 정보
   ======================================== */
.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    margin-top: 20px;
}

/* 파일 선택 직후 compact 표시 (PreviewUI 뜨면 숨김) */
.file-info-compact {
    padding: 10px 16px;
    margin-top: 12px;
    border-radius: 8px;
}
.file-info-compact .file-details i {
    font-size: 1.6rem;
}
.file-info-compact .file-name {
    font-size: 0.95rem;
    margin-bottom: 2px;
}
.file-info-compact .file-size {
    font-size: 0.8rem;
}
/* PreviewUI가 표시되면 file-info 자동 숨김 (JS에서 처리) */

.file-details {
    display: flex;
    align-items: center;
    gap: 15px;
}

.file-details i {
    font-size: 2.5rem;
    color: var(--success-color);
}

.file-meta {
    text-align: left;
}

.file-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.file-size {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ========================================
   버튼
   ======================================== */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-family);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-secondary {
    background: var(--text-secondary);
    color: white;
}

.btn-secondary:hover {
    background: var(--text-primary);
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.report-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ========================================
   진행 바
   ======================================== */
.progress-bar {
    width: 100%;
    height: 30px;
    background: var(--bg-secondary);
    border-radius: 15px;
    overflow: hidden;
    position: relative;
    margin-bottom: 15px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--primary-light) 100%);
    border-radius: 15px;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.progress-text {
    text-align: center;
    font-weight: 500;
    color: var(--text-secondary);
}

/* ========================================
   v3.2.1: 개선된 다단계 진행 바
   ======================================== */

/* 진행 단계 컨테이너 */
.progress-steps {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 40px;
    position: relative;
    padding: 0 30px;
}

/* 단계 연결선 */
.progress-steps::before {
    content: '';
    position: absolute;
    top: 30px;
    left: 90px;
    right: 90px;
    height: 3px;
    background: var(--border-color);
    z-index: 0;
}

/* 개별 단계 */
.progress-step {
    flex: 1;
    text-align: center;
    position: relative;
    z-index: 1;
    max-width: 120px;
}

/* 단계 아이콘 */
.step-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin: 0 auto 12px;
    transition: all 0.3s ease;
    position: relative;
}

/* 대기 중 단계 */
.progress-step.pending .step-icon {
    background: white;
    border-color: var(--border-color);
    opacity: 0.6;
}

/* 완료된 단계 */
.progress-step.completed .step-icon {
    background: var(--success-color);
    border-color: var(--success-color);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.progress-step.completed .step-icon::before {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 28px;
    font-weight: bold;
}

/* 현재 진행 중인 단계 */
.progress-step.active .step-icon {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    animation: pulse 1.5s infinite;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7);
    }
    50% {
        box-shadow: 0 0 0 15px rgba(37, 99, 235, 0);
    }
}

/* 단계 레이블 */
.step-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 1.4;
}

.progress-step.active .step-label {
    color: var(--primary-color);
    font-weight: 600;
}

.progress-step.completed .step-label {
    color: var(--success-color);
    font-weight: 600;
}

/* 전체 진행률 바 */
.progress-bar-overall {
    height: 45px;
    background: var(--bg-secondary);
    border-radius: 22px;
    position: relative;
    overflow: hidden;
    margin-bottom: 25px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.progress-fill-overall {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    border-radius: 22px;
    transition: width 0.5s ease;
    position: relative;
    overflow: hidden;
}

.progress-fill-overall::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

.progress-percentage {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 700;
    font-size: 16px;
    color: var(--text-primary);
    z-index: 2;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

/* 상세 진행 정보 */
.progress-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    padding: 25px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.progress-detail-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.detail-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 17px;
    color: var(--text-primary);
    font-weight: 700;
}

/* 레거시 진행 바 (하위 호환성) */
.progress-bar-legacy {
    width: 100%;
    height: 30px;
    background: var(--bg-secondary);
    border-radius: 15px;
    overflow: hidden;
    position: relative;
    margin-bottom: 15px;
}

.progress-text-legacy {
    text-align: center;
    font-weight: 500;
    color: var(--text-secondary);
}

/* 모바일 반응형 */
@media (max-width: 768px) {
    .progress-steps {
        flex-direction: column;
        gap: 30px;
        padding: 0;
        align-items: center;
    }
    
    .progress-steps::before {
        display: none;
    }
    
    .progress-step {
        max-width: 100%;
        width: 100%;
        display: flex;
        align-items: center;
        text-align: left;
        gap: 15px;
    }
    
    .step-icon {
        margin: 0;
        flex-shrink: 0;
    }
    
    .step-label {
        flex: 1;
        font-size: 15px;
        text-align: left;
    }
    
    .progress-details {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 20px;
    }
    
    .progress-percentage {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .step-icon {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .progress-bar-overall {
        height: 35px;
    }
}

/* ========================================
   보고서 스타일
   ======================================== */
.report-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background: var(--bg-secondary);
    padding: 25px;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
    transition: transform 0.3s ease;
}

.summary-card:hover {
    transform: translateY(-5px);
}

.summary-card.success {
    border-left-color: var(--success-color);
}

.summary-card.warning {
    border-left-color: var(--warning-color);
}

.summary-card.danger {
    border-left-color: var(--danger-color);
}

.summary-card.info {
    border-left-color: var(--info-color);
}

.summary-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.summary-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.report-section-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 30px 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.report-section-title i {
    color: var(--primary-color);
}

.column-analysis {
    margin-bottom: 30px;
}

.column-header {
    background: var(--bg-secondary);
    padding: 15px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.column-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.column-type {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.column-type.number {
    background: #dbeafe;
    color: #1e40af;
}

.column-type.date {
    background: #dcfce7;
    color: #166534;
}

.column-type.text {
    background: #fef3c7;
    color: #92400e;
}

.column-type.phone {
    background: #e0e7ff;
    color: #3730a3;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-item {
    background: var(--bg-primary);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.issue-list {
    margin-top: 15px;
}

.issue-item {
    padding: 12px 15px;
    background: #fef2f2;
    border-left: 3px solid var(--danger-color);
    border-radius: 6px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.issue-item i {
    color: var(--danger-color);
}

.warning-item {
    background: #fffbeb;
    border-left-color: var(--warning-color);
}

.warning-item i {
    color: var(--warning-color);
}

.chart-container {
    position: relative;
    height: 400px;
    margin: 20px 0;
}

/* ========================================
   진단 설정 패널 (v4.2)
   ======================================== */

/* 섹션 래퍼 */
.settings-section {
    margin: 0 0 16px 0;
}

.settings-panel-wrap {
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    transition: box-shadow .2s;
}
.settings-panel-wrap:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,.1);
}

/* ── 토글 헤더 버튼 ── */
.settings-toggle-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s;
}
.settings-toggle-btn:hover { background: rgba(99,102,241,.04); }
.settings-toggle-btn[aria-expanded="true"] { background: rgba(99,102,241,.06); }

.settings-toggle-left {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .92rem;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
}
.settings-toggle-left .fa-sliders-h {
    color: #6366f1;
    font-size: 1rem;
}

/* 변경됨 뱃지 */
.settings-badge {
    font-size: .72rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fde68a;
}

/* 화살표 회전 */
.settings-toggle-arrow {
    font-size: .8rem;
    color: var(--text-secondary, #64748b);
    transition: transform .25s ease;
}
.settings-toggle-btn[aria-expanded="true"] .settings-toggle-arrow {
    transform: rotate(180deg);
}

/* ── 패널 본문 ── */
.settings-panel-body {
    border-top: 1px solid var(--border-color, #e2e8f0);
    padding: 18px 20px 14px;
    animation: settingsFadeIn .2s ease;
}
@keyframes settingsFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── 그룹 탭 (그룹 ≥ 2개일 때) ── */
.settings-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.settings-tab-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    font-size: .82rem;
    font-weight: 500;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 20px;
    background: none;
    cursor: pointer;
    color: var(--text-secondary, #64748b);
    transition: all .15s;
}
.settings-tab-btn:hover { border-color: #6366f1; color: #6366f1; }
.settings-tab-btn.active {
    background: #6366f1;
    border-color: #6366f1;
    color: #fff;
}

/* ── 설정 그룹 ── */
.settings-group { display: none; }
.settings-group.active { display: block; }

.settings-group-desc {
    font-size: .82rem;
    color: var(--text-secondary, #64748b);
    margin-bottom: 14px;
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: 6px;
    border-left: 3px solid #6366f1;
}

/* ── 설정 아이템 그리드 ── */
.settings-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

/* ── 개별 설정 아이템 ── */
.settings-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.settings-item-label {
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
    display: flex;
    align-items: center;
    gap: 5px;
}
.settings-item-desc {
    font-size: .75rem;
    color: var(--text-secondary, #94a3b8);
    line-height: 1.4;
}
.settings-item-input-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

/* 숫자 입력 */
.settings-input-number {
    width: 90px;
    padding: 5px 9px;
    border: 1.5px solid var(--border-color, #e2e8f0);
    border-radius: 6px;
    font-size: .88rem;
    font-family: inherit;
    color: var(--text-primary, #1e293b);
    transition: border-color .15s, box-shadow .15s;
    background: #fff;
}
.settings-input-number:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
.settings-input-number.is-changed {
    border-color: #f59e0b;
    background: #fffbeb;
}
.settings-input-number.is-error {
    border-color: #ef4444;
    background: #fef2f2;
}

/* 단위 텍스트 */
.settings-input-unit {
    font-size: .8rem;
    color: var(--text-secondary, #64748b);
}

/* 토글 스위치 (boolean 타입용) */
.settings-toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}
.settings-toggle-switch input { display: none; }
.settings-toggle-slider {
    position: absolute;
    inset: 0;
    background: #cbd5e1;
    border-radius: 22px;
    cursor: pointer;
    transition: background .2s;
}
.settings-toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px; height: 16px;
    left: 3px; top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.settings-toggle-switch input:checked + .settings-toggle-slider { background: #6366f1; }
.settings-toggle-switch input:checked + .settings-toggle-slider::before { transform: translateX(18px); }

/* ── 액션 바 ── */
.settings-action-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--border-color, #f1f5f9);
}
.settings-action-spacer { flex: 1; }

.btn-settings-reset {
    font-size: .8rem;
    padding: 5px 12px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 6px;
    background: none;
    cursor: pointer;
    color: var(--text-secondary, #64748b);
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all .15s;
}
.btn-settings-reset:hover {
    border-color: #ef4444;
    color: #ef4444;
    background: #fef2f2;
}

.btn-settings-save {
    font-size: .8rem;
    padding: 5px 14px;
    border: none;
    border-radius: 6px;
    background: #6366f1;
    color: #fff;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background .15s;
}
.btn-settings-save:hover { background: #4f46e5; }
.btn-settings-save:disabled { background: #a5b4fc; cursor: not-allowed; }

/* 저장됨 힌트 */
.settings-saved-hint {
    font-size: .78rem;
    color: #16a34a;
    display: flex;
    align-items: center;
    gap: 4px;
    animation: settingsSavedFade 2.5s forwards;
}
@keyframes settingsSavedFade {
    0%   { opacity: 1; }
    70%  { opacity: 1; }
    100% { opacity: 0; }
}

/* ── 반응형 ── */
@media (max-width: 600px) {
    .settings-items-grid { grid-template-columns: 1fr; }
    .settings-action-bar { flex-wrap: wrap; }
}

/* ========================================
   진단기준 설정 헤더 버튼 (v4.2)
   ======================================== */
/* btn-outline-criteria — 하위 호환 유지 */
.btn-outline-criteria {
    background: rgba(255,255,255,0.12);
    border: 1.5px solid rgba(255,255,255,0.45);
    color: white;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 7px;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
    white-space: nowrap;
    font-family: var(--font-family);
}
.btn-outline-criteria:hover {
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.9);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.15);
}
.btn-outline-criteria .fa-sliders-h { font-size: 0.85rem; }

/* ========================================
   진단기준 설정 모달 (3-Panel, v4.2)
   ======================================== */

/* 오버레이 */
.dcm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(3px);
    animation: dcmFadeIn .2s ease;
}
@keyframes dcmFadeIn { from{opacity:0} to{opacity:1} }

/* 다이얼로그 */
.dcm-dialog {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0,0,0,.25);
    width: 100%;
    max-width: 1060px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: dcmSlideUp .25s ease;
}
@keyframes dcmSlideUp {
    from { opacity:0; transform:translateY(20px); }
    to   { opacity:1; transform:translateY(0); }
}

/* ── 모달 헤더 ── */
.dcm-header {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    flex-shrink: 0;
    background: #fafafa;
    gap: 10px;
    flex-wrap: wrap;
}
.dcm-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.dcm-header-left .fa-sliders-h { color: #6366f1; font-size: 1.1rem; }
.dcm-header-left h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary, #111827);
    margin: 0;
}
.dcm-badge-changed {
    display: inline-flex;
    align-items: center;
    font-size: .72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    background: #fff7ed;
    color: #c2410c;
    border: 1px solid #fed7aa;
    animation: dcm-pulse-badge 1.5s ease-in-out infinite;
}
.dcm-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}
.dcm-saved-hint {
    font-size: .78rem;
    color: #16a34a;
    display: flex;
    align-items: center;
    gap: 4px;
    animation: dcmSavedFade 2.5s forwards;
}
@keyframes dcmSavedFade { 0%{opacity:1} 70%{opacity:1} 100%{opacity:0} }

.dcm-btn-reset {
    font-size: .78rem;
    padding: 5px 12px;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 6px;
    background: none;
    cursor: pointer;
    color: var(--text-secondary, #6b7280);
    font-family: inherit;
    display: flex; align-items: center; gap: 5px;
    transition: all .15s;
}
.dcm-btn-reset:hover { border-color:#ef4444; color:#ef4444; background:#fef2f2; }

.dcm-btn-save {
    font-size: .82rem;
    font-weight: 600;
    padding: 6px 16px;
    border: none;
    border-radius: 6px;
    background: #6366f1;
    color: #fff;
    cursor: pointer;
    font-family: inherit;
    display: flex; align-items: center; gap: 5px;
    transition: background .15s;
}
.dcm-btn-save:hover  { background: #4f46e5; }
.dcm-btn-save:disabled { background: #a5b4fc; cursor: not-allowed; }

.dcm-btn-close {
    width: 30px; height: 30px;
    border: none;
    border-radius: 6px;
    background: none;
    cursor: pointer;
    color: var(--text-secondary, #6b7280);
    font-size: .9rem;
    display: flex; align-items: center; justify-content: center;
    transition: all .15s;
}
.dcm-btn-close:hover { background: #fee2e2; color: #ef4444; }

/* ── 3-Panel 본문 ── */
.dcm-body {
    display: grid;
    grid-template-columns: 160px 210px 1fr;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* Panel 공통 */
.dcm-panel-a,
.dcm-panel-b,
.dcm-panel-c {
    overflow-y: auto;
    height: 100%;
}
.dcm-panel-a { border-right: 1px solid var(--border-color, #e5e7eb); background: #f8fafc; }
.dcm-panel-b { border-right: 1px solid var(--border-color, #e5e7eb); }
.dcm-panel-c { padding: 0 0 16px; }

/* Panel 제목 */
.dcm-panel-title {
    font-size: .75rem;
    font-weight: 700;
    color: var(--text-secondary, #6b7280);
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 12px 14px 8px;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    background: #f8fafc;
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.dcm-panel-c-type { display: flex; align-items: center; gap: 4px; font-size: .78rem; }
.dcm-panel-c-sep  { color: #d1d5db; }

/* ── Panel A: 타입 버튼 ── */
.dcm-type-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
    font-size: .83rem;
    color: var(--text-primary, #111827);
    transition: background .15s;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
}
.dcm-type-btn:hover  { background: #f1f5f9; }
.dcm-type-btn.active { background: #ede9fe; color: #4f46e5; font-weight: 600; }
.dcm-type-btn.active .dcm-type-arrow { color: #6366f1; }

.dcm-type-icon {
    width: 28px; height: 28px;
    border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    font-size: .78rem;
    flex-shrink: 0;
}
.dcm-type-label { flex: 1; }
.dcm-type-arrow { font-size: .65rem; color: #d1d5db; }

/* ── Panel B: 서브타입 버튼 ── */
.dcm-subtype-list { padding: 6px 0; }

.dcm-subtype-btn {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 9px 14px;
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s;
    border-bottom: 1px solid #f8fafc;
    position: relative;
}
.dcm-subtype-btn:hover  { background: #f8fafc; }
.dcm-subtype-btn.active { background: #ede9fe; border-left: 3px solid #6366f1; }
.dcm-subtype-btn.active .dcm-subtype-label { color: #4f46e5; font-weight: 600; }

.dcm-subtype-label {
    font-size: .82rem;
    color: var(--text-primary, #111827);
    font-weight: 500;
    line-height: 1.3;
}
.dcm-subtype-example {
    font-size: .72rem;
    color: var(--text-secondary, #9ca3af);
    font-family: 'Courier New', monospace;
}
.dcm-dot-changed {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: .5rem;
    color: #f59e0b;
}

/* ── Panel C: 진단기준 폼 ── */
.dcm-empty-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #d1d5db;
    gap: 10px;
    font-size: .88rem;
}
.dcm-empty-hint .fas { font-size: 1.5rem; }

/* 기준 섹션 */
.dcm-criteria-section { padding: 14px 18px 6px; }

.dcm-criteria-section-header {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: .75rem;
    font-weight: 700;
    color: var(--text-secondary, #6b7280);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px dashed #e5e7eb;
}

/* 기준 그리드 */
.dcm-criteria-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

/* 개별 기준 아이템 */
/* ── 기능 개요 배너 ── */
.dcm-feature-banner {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 10px 20px;
    background: linear-gradient(135deg, #f0f4ff 0%, #fff7ed 100%);
    border-bottom: 1px solid #e5e7eb;
    flex-wrap: wrap;
    position: relative;
}
.dcm-feature-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 16px 4px 0;
    min-width: 140px;
    flex: 1;
}
.dcm-feature-item + .dcm-feature-item {
    border-left: 1px solid #e5e7eb;
    padding-left: 16px;
}
.dcm-feature-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    flex-shrink: 0;
    font-size: 0.85rem;
}
.dcm-feature-title {
    font-size: .78rem;
    font-weight: 700;
    color: #374151;
    line-height: 1.3;
}
.dcm-feature-desc {
    font-size: .70rem;
    color: #6b7280;
    line-height: 1.3;
}
.dcm-feature-dismiss {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 2px 5px;
    border-radius: 4px;
    transition: color .15s;
}
.dcm-feature-dismiss:hover { color: #374151; }

/* ── 기준 아이템 개선 ── */
.dcm-item-label-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.dcm-item-modified-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    font-size: .66rem;
    font-weight: 700;
    line-height: 1.5;
}
/* v5.9: '커스텀' 배지 — 저장된 변경값 (영구 표시) */
.dcm-item-modified-badge.dcm-badge-saved {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
}
/* v5.9: '미저장' 배지 — 저장 전 변경 중 (임시 표시) */
.dcm-item-modified-badge.dcm-badge-unsaved {
    background: #fff7ed;
    color: #c2410c;
    border-color: #fed7aa;
    animation: dcm-pulse-badge 1.5s ease-in-out infinite;
}
@keyframes dcm-pulse-badge {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.6; }
}
.dcm-item-default {
    font-size: .68rem;
    color: #9ca3af;
    margin-left: auto;
}
.dcm-item-range-hint {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 1px;
}
.dcm-item-range {
    display: inline-flex;
    align-items: center;
    padding: 1px 7px;
    background: rgba(99,102,241,.07);
    color: #6366f1;
    border: 1px solid rgba(99,102,241,.18);
    border-radius: 8px;
    font-size: .67rem;
    font-weight: 600;
}

/* ── 헤더 버튼 배지 ── */

.dcm-criteria-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    transition: border-color .15s, box-shadow .15s;
}
.dcm-criteria-item:hover {
    border-color: #a5b4fc;
    box-shadow: 0 0 0 3px rgba(99,102,241,.07);
}

.dcm-item-info { display: flex; flex-direction: column; gap: 2px; }
.dcm-item-label {
    font-size: .81rem;
    font-weight: 600;
    color: var(--text-primary, #111827);
}
.dcm-item-label.is-changed { color: #b45309; }
.dcm-item-desc {
    font-size: .72rem;
    color: #9ca3af;
    line-height: 1.4;
}

.dcm-item-input-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}
.dcm-item-unit {
    font-size: .75rem;
    color: #9ca3af;
}

/* 공통 인풋 스타일 */
.dcm-input-number,
.dcm-input-text {
    padding: 5px 8px;
    border: 1.5px solid #e5e7eb;
    border-radius: 6px;
    font-size: .84rem;
    font-family: inherit;
    color: var(--text-primary, #111827);
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
.dcm-input-number { width: 88px; }
.dcm-input-text   { width: 100%; }
.dcm-input-number:focus,
.dcm-input-text:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.dcm-input-number::placeholder,
.dcm-input-text::placeholder { color: #d1d5db; }
/* tag_list 입력 영역 */
.dcm-tag-list-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}
.dcm-tag-input { width: 100%; }
.dcm-tag-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    min-height: 0;
}
.dcm-tag-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    font-size: .72rem;
    font-weight: 600;
}
.dcm-tag-counter {
    font-size: .7rem;
    color: #6b7280;
    text-align: right;
}
.dcm-tag-counter.error { color: #ef4444; font-weight: 700; }

/* regex_input 영역 */
.dcm-regex-wrap { display: flex; flex-direction: column; gap: 5px; width: 100%; }
.dcm-regex-input-row {
    display: flex;
    align-items: center;
    gap: 4px;
}
.dcm-regex-slash {
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    font-weight: 700;
    color: #9ca3af;
    user-select: none;
    padding: 0 2px;
}
.dcm-regex-input {
    flex: 1;
    font-family: 'Courier New', monospace;
    font-size: .83rem;
    letter-spacing: .01em;
}
.dcm-input-ok {
    border-color: #10b981 !important;
    box-shadow: 0 0 0 3px rgba(16,185,129,.12) !important;
}
.dcm-regex-feedback {
    font-size: .72rem;
    min-height: 16px;
}
.dcm-regex-feedback.ok    { color: #059669; font-weight: 600; }
.dcm-regex-feedback.error { color: #ef4444; font-weight: 600; }
.dcm-regex-test-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.dcm-regex-test-input {
    flex: 1;
    font-size: .8rem;
    background: #f9fafb;
}
.dcm-regex-test-result {
    font-size: .76rem;
    font-weight: 700;
    white-space: nowrap;
    padding: 2px 8px;
    border-radius: 8px;
}
.dcm-regex-test-result.match   { background:#d1fae5; color:#065f46; }
.dcm-regex-test-result.nomatch { background:#fee2e2; color:#991b1b; }
.dcm-regex-test-result.error   { background:#fef3c7; color:#92400e; }
/* v1.4: 입력값 오류 상태 */
.dcm-input-text.dcm-input-error,
.dcm-input-number.dcm-input-error {
    border-color: #ef4444;
    background: #fff5f5;
    box-shadow: 0 0 0 3px rgba(239,68,68,.12);
}
.dcm-input-text.dcm-input-error:focus,
.dcm-input-number.dcm-input-error:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239,68,68,.18);
}

/* 셀렉트 */
.dcm-input-select {
    padding: 5px 8px;
    border: 1.5px solid #e5e7eb;
    border-radius: 6px;
    font-size: .82rem;
    font-family: inherit;
    color: var(--text-primary, #111827);
    background: #fff;
    cursor: pointer;
    transition: border-color .15s;
    min-width: 90px;
}
.dcm-input-select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}

/* 토글 스위치 */
.dcm-toggle {
    position: relative;
    display: inline-block;
    width: 40px; height: 22px;
    cursor: pointer;
    flex-shrink: 0;
}
.dcm-toggle input { display: none; }
.dcm-toggle-slider {
    position: absolute;
    inset: 0;
    background: #d1d5db;
    border-radius: 22px;
    transition: background .2s;
}
.dcm-toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px; height: 16px;
    left: 3px; top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.dcm-toggle input:checked + .dcm-toggle-slider { background: #6366f1; }
.dcm-toggle input:checked + .dcm-toggle-slider::before { transform: translateX(18px); }

/* ── 모달 푸터 ── */
.dcm-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    border-top: 1px solid var(--border-color, #e5e7eb);
    background: #f8fafc;
    flex-shrink: 0;
}
.dcm-footer-info {
    font-size: .75rem;
    color: #9ca3af;
    display: flex;
    align-items: center;
    gap: 5px;
}
.dcm-changed-count {
    font-size: .75rem;
    color: #b45309;
    font-weight: 600;
}

/* ── 푸터 액션 버튼 (내보내기/가져오기) ── */
.dcm-footer-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.dcm-btn-export, .dcm-btn-import {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: #fff;
    font-size: .78rem;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    transition: all .15s;
}
.dcm-btn-export:hover { background: #f0fdf4; border-color: #6ee7b7; color: #065f46; }
.dcm-btn-import:hover { background: #eff6ff; border-color: #93c5fd; color: #1e40af; }

/* ── 프로파일 바 ── */
.dcm-profile-bar {
    display: flex;
    align-items: center;
    gap: 7px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 4px 10px;
    margin: 0 12px;
}
.dcm-profile-label {
    font-size: .73rem;
    color: #6b7280;
    font-weight: 600;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
}
.dcm-profile-select {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 3px 24px 3px 8px;
    font-size: .8rem;
    font-family: inherit;
    background: #fff;
    color: #1f2937;
    cursor: pointer;
    font-weight: 600;
    min-width: 100px;
    max-width: 160px;
    appearance: auto;
}
.dcm-profile-select:focus { outline: none; border-color: #6366f1; }
.dcm-btn-profile-add, .dcm-btn-profile-del {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: #fff;
    font-size: .75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .15s;
    flex-shrink: 0;
}
.dcm-btn-profile-add:hover { background: #f0fdf4; border-color: #6ee7b7; color: #065f46; }
.dcm-btn-profile-del:hover { background: #fef2f2; border-color: #fca5a5; color: #dc2626; }
.dcm-btn-profile-del:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── 소스 배지 (DB/로컬) ── */
.dcm-source-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: .72rem;
    font-weight: 700;
    white-space: nowrap;
}
.dcm-source-badge.online  { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.dcm-source-badge.offline { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

/* ── Panel B: [신규 등록] 버튼 ── */
.dcm-btn-add-custom {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: calc(100% - 16px);
    margin: 8px;
    padding: 8px;
    border: 1.5px dashed #6366f1;
    border-radius: 8px;
    background: transparent;
    color: #6366f1;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
}
.dcm-btn-add-custom:hover { background: #ede9fe; border-style: solid; }

/* ── Panel B: 커스텀 서브타입 구분 ── */
.dcm-subtype-btn.is-custom {
    border-left: 3px solid #6366f1;
    padding-left: 9px;
}
.dcm-badge-custom {
    font-size: .65rem;
    padding: 1px 5px;
    background: #ede9fe;
    color: #5b21b6;
    border-radius: 10px;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}
.dcm-subtype-del {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid #fca5a5;
    background: #fff;
    color: #ef4444;
    font-size: .7rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity .15s;
}
.dcm-subtype-btn:hover .dcm-subtype-del { opacity: 1; }

/* ── 커스텀 등록 폼 ── */
.dcm-custom-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 4px 2px;
}
.dcm-custom-form-section {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 14px 16px;
}
.dcm-custom-form-title {
    font-size: .8rem;
    font-weight: 700;
    color: #374151;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.dcm-custom-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
}
.dcm-custom-label {
    font-size: .78rem;
    font-weight: 600;
    color: #374151;
}
.dcm-custom-label .req { color: #ef4444; }
.dcm-custom-input {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: .83rem;
    font-family: inherit;
    transition: border-color .15s;
}
.dcm-custom-input:focus { outline: none; border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.1); }
.dcm-custom-hint {
    font-size: .71rem;
    color: #9ca3af;
}
.dcm-criteria-checklist {
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.dcm-criteria-check-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 6px;
    transition: background .12s;
}
.dcm-criteria-check-item:hover { background: #ede9fe; }
.dcm-criteria-check-item input[type=checkbox] { width: 15px; height: 15px; accent-color: #6366f1; cursor: pointer; }
.dcm-criteria-check-item input[type=checkbox]:disabled { opacity: 0.5; cursor: not-allowed; }
.dcm-check-label { font-size: .8rem; color: #374151; flex: 1; }
.dcm-check-type-badge {
    font-size: .67rem;
    padding: 1px 6px;
    background: #e0e7ff;
    color: #3730a3;
    border-radius: 8px;
    font-weight: 600;
}
.dcm-custom-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
.dcm-btn-cancel-custom {
    padding: 7px 16px;
    border-radius: 7px;
    border: 1px solid #d1d5db;
    background: #fff;
    font-size: .82rem;
    cursor: pointer;
    color: #6b7280;
    font-weight: 600;
}
.dcm-btn-cancel-custom:hover { background: #f9fafb; }
.dcm-btn-register-custom {
    padding: 7px 18px;
    border-radius: 7px;
    border: none;
    background: #6366f1;
    color: #fff;
    font-size: .82rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background .15s;
}
.dcm-btn-register-custom:hover { background: #4f46e5; }

/* ── 토스트 알림 ── */
.dcm-toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1e293b;
    color: #fff;
    padding: 10px 22px;
    border-radius: 24px;
    font-size: .85rem;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0,0,0,.25);
    z-index: 99999;
    opacity: 0;
    transition: opacity .25s, transform .25s;
    pointer-events: none;
    white-space: nowrap;
}
.dcm-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── 반응형 ── */
@media (max-width: 700px) {
    .dcm-body { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; }
    .dcm-panel-a { border-right: none; border-bottom: 1px solid var(--border-color,#e5e7eb); max-height: 120px; display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; }
    .dcm-type-btn { width: auto; flex: 1 1 120px; border-radius: 8px; border: 1px solid #e5e7eb; }
    .dcm-panel-b { border-right: none; border-bottom: 1px solid var(--border-color,#e5e7eb); max-height: 140px; }
    .dcm-subtype-list { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; }
    .dcm-subtype-btn { width: auto; flex: 1 1 130px; border-radius: 8px; border: 1px solid #e5e7eb; }
    .dcm-criteria-grid { grid-template-columns: 1fr; }
}

/* ========================================
   푸터
   ======================================== */
.footer {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 50px;
}

/* ========================================
   반응형 디자인
   ======================================== */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header {
        padding: 30px 20px;
    }
    
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .card-body {
        padding: 20px;
    }
    
    .report-actions {
        flex-direction: column;
    }
    
    .report-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    .summary-value {
        font-size: 1.5rem;
    }
    
    .chart-container {
        height: 300px;
    }
}

/* ========================================
   진단 흐름 UI v5.0
   - 품질진단 시작 버튼 (미리보기 하단 대형)
   - 진단기준 매핑 인라인 섹션
   ======================================== */

/* 대형 진단 시작 버튼 */
.btn-lg-diag {
    padding: 11px 28px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(16,185,129,0.3);
    transition: all 0.2s;
}
.btn-lg-diag:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(16,185,129,0.4);
}

/* 미리보기 하단 품질진단 시작 버튼 — 중앙 대형 */
.btn-analyze-center {
    padding: 14px 40px;
    font-size: 1.1rem;
    letter-spacing: 0.02em;
    border-radius: 50px;
    min-width: 220px;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(16,185,129,0.35);
}
.btn-analyze-center:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(16,185,129,0.45);
}

/* ── 플로우 화살표 (섹션 간 연결) ─────────────────── */
.flow-arrow-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 4px 0;
    gap: 0;
}
.flow-arrow-line {
    width: 2px;
    height: 22px;
    background: linear-gradient(180deg, #93c5fd 0%, #3b82f6 100%);
    border-radius: 1px;
}
.flow-arrow-head {
    width: 26px;
    height: 26px;
    background: #3b82f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.7rem;
    box-shadow: 0 2px 8px rgba(59,130,246,.35);
}

/* ── STEP 배지 ────────────────────────────────────── */
.flow-step-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: white;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    box-shadow: 0 2px 6px rgba(37,99,235,.3);
    flex-shrink: 0;
    white-space: nowrap;
}
.flow-step-badge-report {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    box-shadow: 0 2px 6px rgba(109,40,217,.3);
}

/* ── 진단기준 매핑 카드 ───────────────────────────── */
.mapping-inline-card {
    border: 2px solid #3b82f6 !important;
    border-radius: 12px !important;
    overflow: visible !important;
}
.mapping-inline-header {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%) !important;
    border-bottom: 1px solid #bfdbfe !important;
    justify-content: space-between !important;
    flex-wrap: wrap;
    gap: 8px;
}
.mapping-temp-badge {
    font-size: 0.72rem;
    color: #6b7280;
    background: #fef9c3;
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid #fde047;
    white-space: nowrap;
    flex-shrink: 0;
}
.mapping-toggle-btn {
    background: white;
    border: 1px solid #93c5fd;
    color: #2563eb;
    padding: 5px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}
.mapping-toggle-btn:hover { background: #eff6ff; }

.mapping-inline-footer {
    padding: 14px 20px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

/* ── 보고서 카드 STEP3 ────────────────────────────── */
.report-card-step3 {
    border-top: 3px solid #8b5cf6 !important;
}

/* 인라인 매핑 섹션 — 진입 애니메이션 */
#mappingInlineSection {
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* 인라인 카드 리스트 스크롤바 */
#cmpInlineBody::-webkit-scrollbar { width: 6px; }
#cmpInlineBody::-webkit-scrollbar-track { background: #f1f5f9; border-radius: 3px; }
#cmpInlineBody::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
#cmpInlineBody::-webkit-scrollbar-thumb:hover { background: #94a3b8; }


/* ══════════════════════════════════════════════════════════════════
   CriteriaMappingPopup — 진단기준 매핑 확인 팝업  v1.0
   ══════════════════════════════════════════════════════════════════ */

/* 오버레이 */
.cmp-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.52);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity .22s ease;
}
.cmp-overlay.cmp-visible { opacity: 1; }

/* 다이얼로그 */
.cmp-dialog {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 80px rgba(0,0,0,.28);
    width: 100%;
    max-width: 860px;          /* 820 → 860: 타입 레이블 여유 확보 */
    min-height: 0;             /* flex 자식 min-height 초기화 */
    max-height: 90vh;          /* 88 → 90: 화면 활용 극대화 */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px);
    transition: transform .22s ease;
}
.cmp-overlay.cmp-visible .cmp-dialog { transform: translateY(0); }

/* ── 헤더 ── */
.cmp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}
.cmp-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}
.cmp-header-icon {
    font-size: 1.5rem;
    color: #6366f1;
    width: 44px;
    height: 44px;
    background: rgba(99,102,241,.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cmp-header-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}
.cmp-header-sub {
    font-size: .8rem;
    color: #64748b;
    margin: 2px 0 0;
}
.cmp-close-btn {
    width: 34px;
    height: 34px;
    border: none;
    background: #f1f5f9;
    border-radius: 8px;
    cursor: pointer;
    color: #64748b;
    font-size: .95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
    flex-shrink: 0;
}
.cmp-close-btn:hover { background: #e2e8f0; color: #1e293b; }

/* ── 요약 배너 ── */
.cmp-summary {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 14px 24px;
    background: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}
.cmp-sum-item {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}
.cmp-sum-num {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1e293b;
}
.cmp-sum-label {
    font-size: .78rem;
    color: #64748b;
}
.cmp-sum-divider {
    width: 1px;
    height: 28px;
    background: #e2e8f0;
    margin: 0 8px;
}
.cmp-col-ok   { color: #10b981 !important; }
.cmp-col-gray { color: #9ca3af !important; }
.cmp-col-warn { color: #f59e0b !important; }

/* ── 탭 ── */
.cmp-tabs {
    display: flex;
    gap: 4px;
    padding: 10px 24px 0;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
    overflow-x: auto;
}
.cmp-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: none;
    background: transparent;
    border-bottom: 2px solid transparent;
    font-size: .82rem;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    white-space: nowrap;
    transition: color .15s, border-color .15s;
    margin-bottom: -1px;
}
.cmp-tab:hover { color: #1e293b; }
.cmp-tab.active {
    color: #6366f1;
    border-bottom-color: #6366f1;
}
.cmp-tab-cnt {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 18px;
    padding: 0 5px;
    background: #e2e8f0;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 600;
    color: #475569;
}
.cmp-cnt-ok   { background: rgba(16,185,129,.15); color: #059669; }
.cmp-cnt-gray { background: #f1f5f9; color: #9ca3af; }
.cmp-cnt-warn { background: rgba(245,158,11,.15); color: #d97706; }
.cmp-cnt-excl { background: rgba(239,68,68,.12); color: #dc2626; }
.cmp-tab.active .cmp-tab-cnt { background: rgba(99,102,241,.15); color: #6366f1; }

/* ── 검색 ── */
.cmp-search-wrap {
    position: relative;
    padding: 10px 24px 8px;
    flex-shrink: 0;
}
.cmp-search-icon {
    position: absolute;
    left: 36px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: .85rem;
    pointer-events: none;
}
.cmp-search-input {
    width: 100%;
    padding: 8px 36px 8px 34px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: .85rem;
    color: #1e293b;
    background: #f8fafc;
    outline: none;
    transition: border .15s, box-shadow .15s;
    box-sizing: border-box;
}
.cmp-search-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,.12);
    background: #fff;
}
.cmp-search-clear {
    position: absolute;
    right: 36px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    font-size: .95rem;
    padding: 2px;
    display: flex;
    align-items: center;
}
.cmp-search-clear:hover { color: #ef4444; }

/* ── 카드 리스트 본문 ── */
.cmp-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.cmp-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 0;
    color: #94a3b8;
    font-size: .9rem;
}

/* ── 카드 ── */
.cmp-card {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: visible;         /* hidden → visible: 자식 콘텐츠 잘림 방지 */
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
.cmp-card:hover { border-color: #c7d2fe; }
.cmp-card-header {
    display: flex;
    align-items: flex-start;   /* center → flex-start: 두 줄 텍스트 상단 정렬 */
    justify-content: space-between;
    padding: 14px 16px;        /* 12px → 14px: 상하 여백 확대 */
    cursor: pointer;
    user-select: none;
    gap: 12px;
    background: #fafafa;
    border-radius: 10px 10px 0 0; /* 카드 테두리 반경 유지 */
    transition: background .12s;
    min-height: 56px;          /* 최소 높이 보장 */
}
.cmp-card-header:hover { background: #f1f5f9; }
.cmp-card-left {
    display: flex;
    align-items: flex-start;   /* center → flex-start */
    gap: 10px;
    min-width: 0;
    flex: 1;
    overflow: hidden;          /* 컬럼명 말줄임 처리를 위해 */
}
.cmp-col-num {
    font-size: .72rem;
    font-weight: 600;
    color: #94a3b8;
    background: #f1f5f9;
    border-radius: 4px;
    padding: 2px 6px;
    flex-shrink: 0;
    align-self: flex-start;    /* 상단 정렬 */
    margin-top: 4px;           /* 아이콘과 수직 맞춤 */
}
/* 진단기준 서브타입 태그 (카드 헤더 타입레이블 하단) */
.cmp-subkey-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: .68rem;
    font-weight: 500;
    color: #6366f1;
    background: rgba(99,102,241,.08);
    border-radius: 4px;
    padding: 1px 6px;
    margin-left: 4px;
    white-space: nowrap;
}
.cmp-type-dot {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: .85rem;
    flex-shrink: 0;
    margin-top: 2px;           /* 상단 정렬 시 아이콘 미세 보정 */
    opacity: .9;
}
.cmp-card-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;                   /* 남은 공간 모두 차지 */
    gap: 3px;                  /* 컬럼명 ↔ 타입레이블 간격 */
}
.cmp-col-name {
    font-size: .9rem;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.cmp-type-label {
    font-size: .75rem;
    font-weight: 500;
    line-height: 1.5;
    word-break: break-word;
    white-space: normal;
}
/* 타입 레이블 구성 요소 */
.cmp-type-label strong {
    font-weight: 700;
    color: inherit;
}
.cmp-type-sep {
    opacity: .5;
    margin: 0 2px;
}
.cmp-type-code {
    font-size: .68rem;
    font-weight: 400;
    opacity: .55;
    font-family: 'Courier New', monospace;
    background: rgba(0,0,0,.04);
    padding: 1px 4px;
    border-radius: 3px;
    margin-left: 2px;
}
.cmp-type-unknown {
    opacity: .5;
    font-style: italic;
}
.cmp-card-right,
.cmp-col-badges {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    flex-shrink: 0;
    padding-top: 2px;
    flex-wrap: wrap;
    max-width: 240px;
    justify-content: flex-end;
}
/* MappingInlineSection 카드 헤더 컬럼정보 영역 */
.cmp-col-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    gap: 2px;
    overflow: hidden;
}
.cmp-chevron,
.cmp-card-chevron {
    font-size: .8rem;
    color: #94a3b8;
    transition: transform .2s;
    flex-shrink: 0;
    margin-top: 3px;
    align-self: flex-start;
}
.cmp-card-open .cmp-chevron,
.cmp-card-open .cmp-card-chevron { transform: rotate(180deg); }

/* 뱃지 */
.cmp-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}
.cmp-badge-ok   { background: rgba(16,185,129,.12); color: #059669; }
.cmp-badge-gray { background: #f1f5f9;              color: #9ca3af; }
.cmp-badge-warn { background: rgba(245,158,11,.12); color: #d97706; }
.cmp-badge-excl { background: rgba(239,68,68,.12);  color: #dc2626; }

/* 진단제외 카드 스타일 */
.cmp-card-excluded .cmp-card-header {
    background: #fef2f2;
    border-left: 3px solid #fca5a5;
}
/* 요약 배너 진단제외 숫자 색상 */
.cmp-col-excl { color: #dc2626; }

/* 카드 바디 (기준 항목) */
.cmp-card-body {
    display: none;
    padding: 14px 16px 16px;   /* 상하 여백 확대 */
    border-top: 1px solid #f1f5f9;
    border-radius: 0 0 10px 10px; /* 하단 카드 반경 */
}
.cmp-card-open .cmp-card-body { display: block; }

/* 카드 열림 상태 테두리 강조 */
.cmp-card-open {
    border-color: #c7d2fe;
    box-shadow: 0 2px 12px rgba(99,102,241,.08);
}

/* 기준 그룹 */
.cmp-crit-group { margin-bottom: 10px; }
.cmp-crit-group:last-child { margin-bottom: 0; }
.cmp-crit-group-hdr {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .76rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid #f1f5f9;
}
.cmp-crit-items { display: flex; flex-direction: column; gap: 4px; }

/* 기준 항목 */
.cmp-crit-item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 5px 8px;
    border-radius: 6px;
    font-size: .82rem;
    transition: background .12s;
}
.cmp-crit-item:hover { background: #f8fafc; }
.cmp-crit-item.cmp-crit-modified { background: rgba(245,158,11,.06); }
.cmp-crit-lbl {
    color: #475569;
    flex-shrink: 0;
    cursor: help;
}
.cmp-crit-val {
    color: #1e293b;
    font-weight: 600;
    text-align: right;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.cmp-val-changed {
    font-size: .72rem;
    font-weight: 500;
    color: #d97706;
    background: rgba(245,158,11,.1);
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}
.cmp-no-criteria {
    padding: 14px 12px;
    background: #f8fafc;
    border-radius: 8px;
    font-size: .82rem;
    color: #64748b;
    line-height: 1.6;
    display: flex;
    gap: 8px;
    align-items: flex-start;
}
.cmp-no-criteria i { color: #94a3b8; margin-top: 2px; flex-shrink: 0; }
.cmp-no-criteria code {
    background: #e2e8f0;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: .78rem;
    color: #6366f1;
}
/* ✅ v1.1: ip/number_id 등 명시적 '기준없음' 타입 강조 */
.cmp-no-criteria-explicit {
    background: #eff6ff;
    border-left: 3px solid #0ea5e9;
}
.cmp-no-criteria-explicit i { color: #0ea5e9; }

/* ── 푸터 ── */
.cmp-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    border-top: 1px solid #f1f5f9;
    background: #f8fafc;
    gap: 12px;
    flex-shrink: 0;
}
.cmp-footer-left {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .8rem;
    color: #64748b;
    min-width: 0;
}
.cmp-footer-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.cmp-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background .15s, transform .1s;
}
.cmp-btn:active { transform: scale(.97); }
.cmp-btn-cancel {
    background: #f1f5f9;
    color: #475569;
}
.cmp-btn-cancel:hover { background: #e2e8f0; }
.cmp-btn-start {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    box-shadow: 0 2px 8px rgba(99,102,241,.3);
}
.cmp-btn-start:hover {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    box-shadow: 0 4px 12px rgba(99,102,241,.4);
}

/* ── 반응형 ── */
@media (max-width: 640px) {
    .cmp-dialog { max-height: 96vh; border-radius: 12px; }
    .cmp-footer { flex-direction: column; align-items: stretch; }
    .cmp-footer-left { display: none; }
    .cmp-footer-right { justify-content: stretch; }
    .cmp-btn { flex: 1; justify-content: center; }
    .cmp-summary { flex-wrap: wrap; gap: 8px; }
    .cmp-sum-divider { display: none; }
}

/* ========================================
   인쇄 스타일
   ======================================== */
@media print {
    body {
        background: white;
    }
    
    .upload-section,
    .progress-section,
    .report-actions,
    .footer {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        page-break-inside: avoid;
    }
    
    .chart-container {
        page-break-inside: avoid;
    }
}

/* ========================================
   유틸리티 클래스
   ======================================== */
.text-center {
    text-align: center;
}

.mb-20 {
    margin-bottom: 20px;
}

/* ========================================
   인코딩 지원 스타일
   ======================================== */

/* 파일 인코딩 정보 */
.file-encoding {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.file-encoding i {
    color: var(--info-color);
    margin-right: 4px;
}

.encoding-confidence {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    background-color: var(--success-color);
    color: white;
    margin-left: 8px;
}

.encoding-confidence.low {
    background-color: var(--warning-color);
}

/* 모달 기본 스타일 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-xl);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

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

/* v2.2: 알림 애니메이션 */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

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

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h3 i {
    color: var(--primary-color);
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
}

/* 인코딩 경고 메시지 */
.encoding-warning {
    background-color: #fef3c7;
    border-left: 4px solid var(--warning-color);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    gap: 12px;
}

.encoding-warning i {
    color: var(--warning-color);
    font-size: 24px;
    flex-shrink: 0;
}

.encoding-warning p {
    margin: 0;
    color: #92400e;
    line-height: 1.5;
}

/* 인코딩 정보 */
.encoding-info {
    background-color: var(--bg-secondary);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.encoding-info p {
    margin: 0;
    color: var(--text-secondary);
}

.confidence-badge {
    display: inline-block;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 12px;
    background-color: var(--success-color);
    color: white;
    margin-left: 8px;
}

.confidence-badge.medium {
    background-color: var(--warning-color);
}

.confidence-badge.low {
    background-color: var(--danger-color);
}

/* 인코딩 선택기 */
.encoding-selector {
    margin-bottom: 20px;
}

.encoding-selector label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.encoding-select {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background-color: white;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-family);
}

.encoding-select:hover {
    border-color: var(--primary-light);
}

.encoding-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* 인코딩 도움말 */
.encoding-help {
    margin-top: 20px;
}

.encoding-help details {
    background-color: var(--bg-secondary);
    border-radius: 8px;
    padding: 12px 16px;
}

.encoding-help summary {
    cursor: pointer;
    font-weight: 500;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}

.encoding-help summary:hover {
    color: var(--primary-dark);
}

.encoding-help summary i {
    font-size: 14px;
}

.help-content {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.help-content p {
    margin-bottom: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.help-content ul {
    list-style: none;
    padding-left: 0;
    margin-bottom: 12px;
}

.help-content li {
    padding: 8px 0;
    color: var(--text-secondary);
    display: flex;
    align-items: flex-start;
}

.help-content li:before {
    content: "•";
    color: var(--primary-color);
    font-weight: bold;
    display: inline-block;
    width: 1em;
    margin-right: 8px;
}

.help-content .tip {
    background-color: #dbeafe;
    padding: 12px;
    border-radius: 8px;
    border-left: 3px solid var(--info-color);
    margin-top: 12px;
}

/* ══════════════════════════════════════════════
   Excel 시트·헤더행 설정 모달 (ecm = excel config modal)
══════════════════════════════════════════════ */
.excel-config-modal-content {
    width: 720px;
    max-width: 95vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}
.excel-config-modal-content .modal-body {
    overflow-y: auto;
    flex: 1;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 섹션 */
.ecm-section {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 14px 16px;
}
.ecm-section-title {
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.ecm-section-title i { color: #217346; }
.ecm-hint {
    font-size: 11px;
    font-weight: 400;
    color: #64748b;
    margin-left: 6px;
}

/* 시트 목록 */
.ecm-sheet-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.ecm-sheet-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #374151;
    background: #fff;
    transition: all .15s;
    user-select: none;
}
.ecm-sheet-item:hover  { border-color: #86efac; background: #f0fdf4; }
.ecm-sheet-item.selected {
    border-color: #217346;
    background: #f0fdf4;
    color: #14532d;
    font-weight: 600;
}
.ecm-sheet-item i { color: #217346; font-size: 12px; }
.ecm-sheet-rows {
    font-size: 10px;
    color: #6b7280;
    background: #e5e7eb;
    border-radius: 20px;
    padding: 1px 7px;
    margin-left: 2px;
}
.ecm-sheet-item.selected .ecm-sheet-rows {
    background: #bbf7d0;
    color: #14532d;
}

/* 헤더행 스핀박스 */
.ecm-header-row-wrap {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.ecm-header-spinbox {
    display: flex;
    align-items: center;
    gap: 0;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}
.ecm-spin-btn {
    width: 34px;
    height: 34px;
    border: none;
    background: #f3f4f6;
    color: #374151;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background .12s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ecm-spin-btn:hover:not(:disabled) { background: #d1fae5; color: #065f46; }
.ecm-spin-btn:disabled { opacity: .35; cursor: not-allowed; }
.ecm-spin-val {
    min-width: 38px;
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    padding: 0 4px;
    line-height: 34px;
}
.ecm-spin-unit {
    padding: 0 10px;
    font-size: 13px;
    color: #6b7280;
    background: #f9fafb;
    border-left: 1px solid #e5e7eb;
    height: 34px;
    display: flex;
    align-items: center;
}
.ecm-header-hint {
    font-size: 12px;
    color: #64748b;
    margin: 0;
}

/* 미리보기 테이블 */
.ecm-preview-wrap {
    overflow-x: auto;
    max-height: 200px;
    overflow-y: auto;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}
.ecm-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    white-space: nowrap;
}
.ecm-pt-head {
    background: #1e293b;
    color: #e2e8f0;
    font-weight: 600;
    padding: 6px 10px;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 1;
    border-right: 1px solid #334155;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ecm-pt-cell {
    padding: 5px 10px;
    border-bottom: 1px solid #f1f5f9;
    border-right: 1px solid #f1f5f9;
    color: #374151;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ecm-preview-table tbody tr:hover .ecm-pt-cell { background: #f0f9ff; }

/* ══════════════════════════════════════════════════════
   인라인 업로드 패널 (iup = inline upload panel)
══════════════════════════════════════════════════════ */

/* 드롭존: 파일 선택 후 숨김 (iup-file-bar가 대신 표시됨) */
.upload-area.has-file { display: none; }

/* 인라인 파일 바 */
.iup-file-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    margin-top: 10px;
    font-size: 13px;
}
.iup-file-icon { font-size: 20px; flex-shrink: 0; }
.iup-file-name { font-weight: 600; color: #1e293b; flex: 1; min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iup-file-size { font-size: 11px; color: #64748b; white-space: nowrap; }
.iup-change-btn {
    margin-left: auto; flex-shrink: 0;
    border: 1px solid #94a3b8; background: #fff; color: #475569;
    border-radius: 6px; padding: 4px 10px; font-size: 12px; cursor: pointer;
    display: flex; align-items: center; gap: 5px;
    transition: background .12s;
}
.iup-change-btn:hover { background: #f1f5f9; }

/* 공통 인라인 패널 */
.iup-panel {
    margin-top: 10px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #fff;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height .28s ease, opacity .22s ease;
}
.iup-panel.visible {
    max-height: 600px;
    opacity: 1;
}
.iup-panel-header {
    display: flex; align-items: center; gap: 8px;
    padding: 11px 16px;
    font-size: 13px;
}
.iup-panel-header.enc  { background: #fff7ed; border-bottom: 1px solid #fed7aa; color: #c2410c; }
.iup-panel-header.excel { background: #f0fdf4; border-bottom: 1px solid #bbf7d0; color: #166534; }
.iup-panel-sub { font-size: 11px; font-weight: 400; color: #6b7280; margin-left: 4px; }
.iup-panel-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 14px; }
.iup-panel-footer {
    padding: 10px 16px; background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex; justify-content: flex-end; gap: 8px;
}

/* 인코딩 패널 */
.iup-enc-msg { margin: 0; font-size: 13px; color: #374151; }
.iup-enc-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.iup-enc-label { font-size: 12px; font-weight: 600; color: #374151; white-space: nowrap; }
.iup-enc-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.iup-enc-opt {
    padding: 6px 14px; border-radius: 20px;
    border: 2px solid #e2e8f0; background: #fff;
    font-size: 12px; font-weight: 500; color: #374151;
    cursor: pointer; transition: all .12s;
    display: flex; flex-direction: column; align-items: center; gap: 1px;
}
.iup-enc-opt:hover { border-color: #fb923c; background: #fff7ed; }
.iup-enc-opt.selected { border-color: #ea580c; background: #fff7ed; color: #c2410c; font-weight: 700; }
.iup-enc-desc { font-size: 10px; color: #9ca3af; font-weight: 400; }
.iup-enc-opt.selected .iup-enc-desc { color: #f97316; }

/* Excel 패널 */
.iup-exc-section { display: flex; flex-direction: column; gap: 8px; }
.iup-exc-label {
    font-size: 12px; font-weight: 600; color: #374151;
    display: flex; align-items: center; gap: 5px;
}
.iup-exc-label i { color: #217346; }
.iup-exc-hint-sm { font-size: 11px; font-weight: 400; color: #6b7280; margin-left: 6px; }

/* 시트 버튼 */
.iup-exc-sheets { display: flex; gap: 6px; flex-wrap: wrap; }
.iup-exc-sheet-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: 8px;
    border: 2px solid #e2e8f0; background: #fff;
    font-size: 12px; font-weight: 500; color: #374151;
    cursor: pointer; transition: all .12s;
}
.iup-exc-sheet-btn:hover { border-color: #86efac; background: #f0fdf4; }
.iup-exc-sheet-btn.selected { border-color: #217346; background: #f0fdf4; color: #14532d; font-weight: 700; }
.iup-exc-sheet-btn i { font-size: 11px; color: #217346; }
.iup-exc-sheet-rows {
    font-size: 10px; color: #6b7280;
    background: #e5e7eb; border-radius: 20px; padding: 1px 7px;
}
.iup-exc-sheet-btn.selected .iup-exc-sheet-rows { background: #bbf7d0; color: #14532d; }

/* 스핀박스 */
.iup-exc-spinbox { display: flex; align-items: center; gap: 0; flex-wrap: wrap; }
.iup-spin-btn {
    width: 30px; height: 30px; border: 1px solid #d1d5db;
    background: #f3f4f6; color: #374151; font-size: 16px; font-weight: 700;
    cursor: pointer; transition: background .12s; border-radius: 6px 0 0 6px;
}
.iup-spin-btn + .iup-spin-btn { border-radius: 0 6px 6px 0; }
.iup-spin-btn:hover:not(:disabled) { background: #d1fae5; color: #065f46; }
.iup-spin-btn:disabled { opacity: .35; cursor: not-allowed; }
.iup-spin-val {
    min-width: 36px; text-align: center;
    font-size: 16px; font-weight: 700; color: #1e293b;
    border-top: 1px solid #d1d5db; border-bottom: 1px solid #d1d5db;
    padding: 0 6px; line-height: 30px;
}
.iup-spin-unit { padding: 0 8px; font-size: 12px; color: #6b7280; }
.iup-exc-hint { font-size: 11px; color: #6b7280; margin-left: 6px; }

/* 미리보기 테이블 */
.iup-exc-preview-wrap {
    overflow-x: auto; max-height: 160px; overflow-y: auto;
    border-radius: 6px; border: 1px solid #e2e8f0;
}
.iup-exc-preview-table {
    width: 100%; border-collapse: collapse;
    font-size: 11px; white-space: nowrap;
}
.iup-exc-th {
    background: #1e293b; color: #e2e8f0; font-weight: 600;
    padding: 5px 10px; text-align: left;
    position: sticky; top: 0; z-index: 1;
    border-right: 1px solid #334155;
    max-width: 140px; overflow: hidden; text-overflow: ellipsis;
}
.iup-exc-td {
    padding: 4px 10px;
    border-bottom: 1px solid #f1f5f9; border-right: 1px solid #f1f5f9;
    color: #374151; max-width: 140px; overflow: hidden; text-overflow: ellipsis;
}
.iup-exc-preview-table tbody tr:hover .iup-exc-td { background: #f0f9ff; }


/* 반응형 디자인 */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 10px;
    }
    
    .modal-header {
        padding: 16px;
    }
    
    .modal-body {
        padding: 16px;
    }
    
    .modal-footer {
        padding: 12px 16px;
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
}


.mt-20 {
    margin-top: 20px;
}

.hidden {
    display: none !important;
}

/* ========================================
   데이터 미리보기
   ======================================== */
.data-preview {
    margin-top: 30px;
    padding: 25px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    border: 2px solid var(--border-color);
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.preview-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.preview-header h3 i {
    color: var(--primary-color);
}

.preview-info {
    display: flex;
    gap: 10px;
}

.preview-badge {
    padding: 6px 12px;
    background: var(--primary-color);
    color: white;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.preview-table-container {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 500px;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    background: white;
}

.preview-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.preview-table th {
    background: var(--primary-color);
    color: white;
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    border: 1px solid var(--primary-dark);
    white-space: nowrap;
}

.preview-table td {
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    white-space: nowrap;
}

.preview-table tbody tr:nth-child(odd) {
    background: var(--bg-primary);
}

.preview-table tbody tr:nth-child(even) {
    background: var(--bg-secondary);
}

.preview-table tbody tr:hover {
    background: #dbeafe;
    transition: background 0.2s ease;
}

.preview-table td.empty-cell {
    background: #fef2f2;
    color: var(--text-tertiary);
    font-style: italic;
}

.preview-table td.empty-cell::after {
    content: '(빈 값)';
    font-size: 0.8rem;
}

/* 파일 아이콘 동적 변경 */
.file-icon-excel {
    color: #107c41 !important; /* Excel 녹색 */
}

.file-icon-csv {
    color: var(--success-color) !important;
}

.file-icon-json {
    color: #f59e0b !important; /* JSON 오렌지 */
}

/* ========================================
   Phase 1: 타입/패턴 선택 UI 스타일
   ======================================== */

/* 컬럼명 셀 */
.preview-table .column-name {
    font-weight: 600;
    color: var(--primary-color);
    vertical-align: top;
    white-space: normal;
    max-width: 150px;
}

/* 미리보기 값 셀 */
.preview-table .preview-cell {
    vertical-align: top;
    max-width: 300px;
    overflow-y: auto;
    max-height: 200px;
}

.preview-value {
    padding: 4px 8px;
    margin: 2px 0;
    border-radius: 4px;
    background: var(--bg-tertiary);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* v2.0: 스크롤바 스타일 개선 */
.preview-value::-webkit-scrollbar,
div[style*="overflow-y: auto"]::-webkit-scrollbar {
    width: 8px;
}

.preview-value::-webkit-scrollbar-track,
div[style*="overflow-y: auto"]::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.preview-value::-webkit-scrollbar-thumb,
div[style*="overflow-y: auto"]::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.preview-value::-webkit-scrollbar-thumb:hover,
div[style*="overflow-y: auto"]::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.preview-value.empty {
    background: #fef2f2;
    color: var(--text-tertiary);
    font-style: italic;
}

/* v1.6.2: 빈 컬럼 경고 */
.preview-value.empty-all {
    background: #fee2e2;
    color: #991b1b;
    font-weight: 600;
    padding: 8px;
    border-left: 3px solid #ef4444;
}

.preview-value.empty-info {
    background: #dbeafe;
    color: #1e40af;
    font-size: 0.8rem;
    font-style: italic;
    margin-top: 4px;
    padding: 6px 8px;
}

/* v2.1: 데이터 정보 셀 */
.preview-table .info-cell {
    vertical-align: top;
    padding: 12px;
}

.data-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    font-size: 0.85rem;
}

.info-label {
    font-weight: 600;
    color: var(--text-secondary);
}

.info-value {
    font-weight: 700;
    font-family: 'Courier New', monospace;
}

.info-value.text-success {
    color: var(--success-color);
}

.info-value.text-warning {
    color: var(--warning-color);
}

.info-value.text-muted {
    color: var(--text-tertiary);
}

/* 타입 선택 셀 (보고서 페이지에서 사용) */
.preview-table .type-cell {
    vertical-align: top;
}

.type-select {
    width: 100%;
    padding: 8px 10px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.type-select:hover {
    border-color: var(--primary-color);
}

.type-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* 패턴 선택 셀 */
.preview-table .pattern-cell {
    vertical-align: top;
}

.pattern-select {
    width: 100%;
    padding: 8px 10px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.85rem;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pattern-select:hover {
    border-color: var(--info-color);
}

.pattern-select:focus {
    outline: none;
    border-color: var(--info-color);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
}

/* 신뢰도 셀 */
.preview-table .confidence-cell {
    vertical-align: top;
    text-align: center;
}

.confidence-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.confidence-badge.high {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}

.confidence-badge.medium {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #f59e0b;
}

.confidence-badge.low {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
}

/* ========================================
   Phase 2-A: DB 타입 추천 스타일
   ======================================== */

.db-recommendation {
    font-size: 0.85rem;
    line-height: 1.4;
}

.db-type {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.security-badge {
    display: inline-block;
    background: #fee2e2;
    color: #991b1b;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 4px;
    font-weight: 600;
    border: 1px solid #ef4444;
}

.db-reason {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.db-caution {
    font-size: 0.75rem;
    color: var(--warning-color);
    background: #fef3c7;
    padding: 4px 6px;
    border-radius: 4px;
    margin-top: 4px;
    border-left: 3px solid var(--warning-color);
}

.db-suggestion {
    font-size: 0.75rem;
    color: var(--info-color);
    background: #cffafe;
    padding: 4px 6px;
    border-radius: 4px;
    margin-top: 4px;
    border-left: 3px solid var(--info-color);
}

.db-cell {
    vertical-align: top;
    padding: 12px !important;
}

/* 미리보기 테이블 반응형 */
@media (max-width: 1200px) {
    .preview-table {
        font-size: 0.8rem;
    }
    
    .type-select,
    .pattern-select {
        font-size: 0.8rem;
        padding: 6px 8px;
    }
    
    .preview-table .column-name {
        max-width: 120px;
    }
    
    .preview-table .preview-cell {
        max-width: 200px;
    }
    
    .db-recommendation {
        font-size: 0.75rem;
    }
    
    .db-type {
        font-size: 0.8rem;
    }
}

@media (max-width: 768px) {
    .preview-table th,
    .preview-table td {
        padding: 8px 10px;
    }
    
    .preview-table {
        font-size: 0.75rem;
    }
    
    .confidence-badge {
        font-size: 0.7rem;
        padding: 4px 8px;
    }
    
    .db-recommendation {
        font-size: 0.7rem;
    }
}

/* ══════════════════════════════════════════════════════════════
   v3.6.0 — 진단 이력 모달 스타일
   ══════════════════════════════════════════════════════════════ */

/* 모달 오버레이 */
#historyModal.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

/* 모달 다이얼로그 */
#historyModal .modal-dialog {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    width: 100%;
    max-width: 900px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 모달 헤더 */
#historyModal .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
    flex-shrink: 0;
}

#historyModal .modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

#historyModal .modal-title h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

#historyModal .modal-title i {
    color: var(--primary-color);
    font-size: 1.1rem;
}

.history-source-badge {
    font-size: 0.75rem;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 600;
}
.badge-cloud { background: #dbeafe; color: #1d4ed8; }
.badge-local { background: #fef3c7; color: #92400e; }

.modal-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}
.modal-close:hover { color: #1e293b; background: #f1f5f9; }

/* 모달 바디 */
#historyModal .modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* 모달 푸터 */
#historyModal .modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    border-top: 1px solid #e5e7eb;
    background: #f8fafc;
    flex-shrink: 0;
}

.history-count {
    font-size: 0.82rem;
    color: #64748b;
    font-weight: 500;
}

/* 로딩 / 빈 상태 */
.history-loading,
.history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 20px;
    color: #94a3b8;
    font-size: 0.95rem;
}
.history-empty i { font-size: 2.5rem; color: #cbd5e1; }
.history-empty .hint { font-size: 0.82rem; color: #b0bec5; }

/* 이력 테이블 */
.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.history-table thead {
    background: #f1f5f9;
    position: sticky;
    top: 0;
    z-index: 1;
}
.history-table th {
    padding: 11px 14px;
    text-align: left;
    font-weight: 600;
    color: #475569;
    font-size: 0.8rem;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}
.history-table td {
    padding: 11px 14px;
    border-bottom: 1px solid #f1f5f9;
    color: #374151;
    vertical-align: middle;
}
.history-row:hover td { background: #f8fafc; }
.history-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.history-table td.dt  { font-size: 0.8rem; color: #64748b; white-space: nowrap; }
.history-table td.fname { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 품질 점수 배지 */
.score-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
}
.score-good { background: #dcfce7; color: #15803d; }
.score-warn { background: #fef9c3; color: #a16207; }
.score-bad  { background: #fee2e2; color: #b91c1c; }

/* 삭제 버튼 */
.btn-history-del {
    background: none;
    border: 1px solid #e5e7eb;
    color: #94a3b8;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.78rem;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.btn-history-del:hover {
    color: #ef4444;
    border-color: #ef4444;
    background: #fef2f2;
}

/* 반응형 */
@media (max-width: 640px) {
    #historyModal .modal-dialog { max-height: 92vh; }
    .history-table th:nth-child(3),
    .history-table td:nth-child(3),
    .history-table th:nth-child(4),
    .history-table td:nth-child(4) { display: none; }
    .header { flex-direction: column; align-items: flex-start; }
    .header-actions { width: 100%; justify-content: flex-end; }
}


