/* ================================================
   K-Pop MD 재고실사 대시보드 v3.0 - 메인 스타일시트
   Streamlit-like 레이아웃 (사이드바 + 메인)
   ================================================ */

/* --- CSS Variables (디자인 토큰) --- */
:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --primary-bg: #eef2ff;
    --secondary: #ec4899;
    --secondary-light: #f472b6;
    --tertiary: #10b981;
    --tertiary-light: #34d399;
    --quaternary: #f59e0b;
    --quaternary-light: #fbbf24;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --success: #10b981;
    --success-bg: #ecfdf5;

    --bg: #f8fafc;
    --bg-card: #ffffff;
    --sidebar-bg: #1e1b4b;
    --sidebar-text: #c7d2fe;
    --sidebar-text-bright: #ffffff;
    --sidebar-accent: #818cf8;

    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);

    --sidebar-width: 310px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Dark Mode Variables --- */
[data-theme="dark"] {
    --primary: #818cf8;
    --primary-light: #a5b4fc;
    --primary-dark: #6366f1;
    --primary-bg: rgba(99,102,241,0.15);
    --secondary: #f472b6;
    --secondary-light: #f9a8d4;
    --tertiary: #34d399;
    --tertiary-light: #6ee7b7;
    --quaternary: #fbbf24;
    --quaternary-light: #fde68a;
    --danger: #f87171;
    --danger-bg: rgba(239,68,68,0.15);
    --warning: #fbbf24;
    --warning-bg: rgba(245,158,11,0.15);
    --success: #34d399;
    --success-bg: rgba(16,185,129,0.15);
    --bg: #0f172a;
    --bg-card: #1e293b;
    --sidebar-bg: #0c0a1d;
    --text: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #334155;
    --border-light: #1e293b;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.5);
    --shadow-xl: 0 20px 25px rgba(0,0,0,0.5);
}
[data-theme="dark"] .active-filter-bar { background: rgba(99,102,241,0.12); border-color: #4338ca; }
[data-theme="dark"] .active-filter-tag { background: #1e293b; border-color: #4338ca; color: #a5b4fc; }
[data-theme="dark"] .trend-header { background: linear-gradient(90deg, rgba(99,102,241,0.12), transparent); }
[data-theme="dark"] .trend-badge { background: #1e293b; border-color: #4338ca; }
[data-theme="dark"] .warning-header { background: linear-gradient(90deg, rgba(239,68,68,0.1), transparent); }
[data-theme="dark"] .lowstock-header { background: linear-gradient(90deg, rgba(245,158,11,0.1), transparent); }
[data-theme="dark"] .ls-highlight-section { background: linear-gradient(135deg, rgba(139,92,246,0.15), rgba(99,102,241,0.1)); border-color: #6d28d9; }
[data-theme="dark"] .ls-kpi { background: rgba(30,41,59,0.8); border-color: rgba(139,92,246,0.25); }
[data-theme="dark"] .ls-chart-wrap { background: rgba(30,41,59,0.5); border-color: rgba(139,92,246,0.2); }
[data-theme="dark"] .ls-kpi-label { color: #a78bfa; }
[data-theme="dark"] .ls-kpi-value { color: #c4b5fd; }
[data-theme="dark"] .ls-kpi-sub { color: #a78bfa; }
[data-theme="dark"] .chart-toggle { background: #0f172a; }
[data-theme="dark"] .page-btn { background: #1e293b; border-color: #334155; color: #94a3b8; }
[data-theme="dark"] .page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
[data-theme="dark"] .data-controls input,
[data-theme="dark"] .data-controls select { background: #0f172a; border-color: #334155; color: #e2e8f0; }
[data-theme="dark"] .loading-overlay { background: rgba(15,23,42,0.9); }
[data-theme="dark"] .badge-zero { background: #1e293b; color: #64748b; }
[data-theme="dark"] .badge-lowstock { background: rgba(245,158,11,0.15); color: #fbbf24; }
[data-theme="dark"] .empty-state-hint { background: rgba(99,102,241,0.12); color: #818cf8; }
[data-theme="dark"] .feature { background: #1e293b; }
[data-theme="dark"] .pdf-report-header { background: linear-gradient(135deg, #1e293b, #0f172a); }
[data-theme="dark"] .sidebar-select option { background: #1e293b; }
[data-theme="dark"] .multi-select-dropdown { background: #1e293b; }
[data-theme="dark"] .lowstock-header h3 { color: #fbbf24; }

/* --- Dark Mode Toggle Button --- */
.dark-mode-toggle {
    width: 42px; height: 42px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}
.dark-mode-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* --- Widget Drag Handle --- */
.widget-item { position: relative; }
.widget-drag-handle {
    position: absolute; top: 12px; right: 12px; z-index: 5;
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-muted); font-size: 12px;
    cursor: grab; opacity: 0;
    transition: opacity 0.2s, background 0.2s;
}
.widget-item:hover .widget-drag-handle { opacity: 1; }
.widget-drag-handle:hover { background: var(--primary-bg); color: var(--primary); border-color: var(--primary); }
.widget-drag-handle:active { cursor: grabbing; }
.sortable-ghost { opacity: 0.4; }
.sortable-chosen { box-shadow: 0 8px 30px rgba(99,102,241,0.25); }

/* --- Monthly Comparison Section --- */
.month-compare-section {
    background: var(--bg-card); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); border: 1px solid var(--border-light);
    border-left: 4px solid #06b6d4; margin-bottom: 24px; overflow: hidden;
}
.month-compare-header {
    padding: 16px 20px; border-bottom: 1px solid var(--border-light);
    display: flex; align-items: center; justify-content: space-between;
    background: linear-gradient(90deg, rgba(6,182,212,0.08), transparent);
}
.month-compare-header h3 {
    font-size: 15px; font-weight: 700; color: #0891b2;
    display: flex; align-items: center; gap: 8px;
}
[data-theme="dark"] .month-compare-header h3 { color: #22d3ee; }
[data-theme="dark"] .month-compare-header { background: linear-gradient(90deg, rgba(6,182,212,0.1), transparent); }
.compare-badge {
    font-size: 11px; font-weight: 600; color: #0891b2; background: #ecfeff;
    padding: 4px 12px; border-radius: 16px; border: 1px solid #a5f3fc;
    display: flex; align-items: center; gap: 6px;
}
[data-theme="dark"] .compare-badge { background: rgba(6,182,212,0.15); border-color: #155e75; color: #22d3ee; }
.change-up { color: #ef4444; font-weight: 700; }
.change-down { color: #10b981; font-weight: 700; }
.change-flat { color: var(--text-muted); }

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* --- 사이드바 --- */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

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

.logo i {
    font-size: 28px;
    color: var(--sidebar-accent);
}

@keyframes spin-slow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.fa-spin-slow {
    animation: spin-slow 4s linear infinite;
}

.logo h1 {
    font-size: 16px;
    font-weight: 700;
    color: var(--sidebar-text-bright);
    line-height: 1.3;
}
.logo h1 span {
    font-weight: 400;
    font-size: 12px;
    color: var(--sidebar-text);
}

/* 사이드바 섹션 */
.sidebar-section {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-section h3 {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--sidebar-accent);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.sidebar-section h3 i {
    font-size: 12px;
}

/* 드래그 앤 드롭 영역 */
.drop-zone {
    border: 2px dashed rgba(255,255,255,0.2);
    border-radius: var(--radius-sm);
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: rgba(255,255,255,0.03);
}
.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--sidebar-accent);
    background: rgba(99,102,241,0.1);
}
.drop-zone i {
    font-size: 32px;
    color: var(--sidebar-accent);
    margin-bottom: 10px;
    display: block;
}
.drop-zone p {
    font-size: 13px;
    color: var(--sidebar-text);
    margin-bottom: 6px;
}
.drop-zone-hint {
    font-size: 11px;
    color: var(--text-muted);
}

/* 파일 정보 표시 */
.file-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(16,185,129,0.15);
    border-radius: var(--radius-xs);
    margin-top: 10px;
}
.file-info i {
    color: var(--tertiary);
    font-size: 16px;
}
.file-info span {
    font-size: 12px;
    color: var(--sidebar-text-bright);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.file-info button {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
    border-radius: 4px;
    transition: var(--transition);
}
.file-info button:hover {
    background: rgba(239,68,68,0.2);
}

/* 업로드된 파일 목록 */
.uploaded-files-list {
    margin-top: 8px;
}
.uploaded-file-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(99,102,241,0.12);
    border-radius: var(--radius-xs);
    margin-bottom: 4px;
    font-size: 11px;
    color: var(--sidebar-text-bright);
}
.uploaded-file-item i {
    color: var(--sidebar-accent);
    font-size: 10px;
}
.uploaded-file-item .file-month-badge {
    background: var(--sidebar-accent);
    color: #fff;
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    margin-left: auto;
}

/* 사이드바 검색 인풋 */
.sidebar-search-input {
    width: 100%;
    padding: 8px 12px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius-xs);
    color: #fff;
    font-size: 12px;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
}
.sidebar-search-input::placeholder {
    color: var(--text-muted);
}
.sidebar-search-input:focus {
    border-color: var(--sidebar-accent);
    background: rgba(255,255,255,0.12);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

/* 사이드바 셀렉트 */
.sidebar-select {
    width: 100%;
    padding: 8px 12px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius-xs);
    color: #fff;
    font-size: 12px;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    transition: var(--transition);
}
.sidebar-select option {
    background: #2d2a5e;
    color: #fff;
}
.sidebar-select:focus {
    border-color: var(--sidebar-accent);
}

/* 재고 상태 필터 */
.status-filter-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.status-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px 0;
}
.status-checkbox input[type="checkbox"] {
    accent-color: var(--sidebar-accent);
    width: 14px;
    height: 14px;
    cursor: pointer;
}
.status-checkbox .badge {
    font-size: 11px;
    pointer-events: none;
}

/* 필터 그룹 */
.filter-group {
    margin-bottom: 14px;
}
.filter-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--sidebar-text);
    margin-bottom: 6px;
}
.filter-group label i {
    font-size: 11px;
    color: var(--sidebar-accent);
}

/* 커스텀 멀티셀렉트 */
.multi-select-wrapper {
    position: relative;
}
.multi-select-header {
    padding: 8px 12px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius-xs);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--sidebar-text);
    transition: var(--transition);
}
.multi-select-header:hover {
    border-color: var(--sidebar-accent);
}
.multi-select-header i {
    font-size: 10px;
    transition: transform 0.2s;
}

.multi-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #2d2a5e;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius-xs);
    margin-top: 4px;
    z-index: 50;
    max-height: 280px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
}

.dropdown-search {
    padding: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.dropdown-search input {
    width: 100%;
    padding: 6px 10px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 4px;
    color: #fff;
    font-size: 12px;
    font-family: inherit;
    outline: none;
}
.dropdown-search input::placeholder {
    color: var(--text-muted);
}

.dropdown-actions {
    padding: 6px 8px;
    display: flex;
    gap: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.dropdown-actions button {
    flex: 1;
    padding: 4px 8px;
    font-size: 11px;
    font-family: inherit;
    background: rgba(255,255,255,0.08);
    border: none;
    border-radius: 4px;
    color: var(--sidebar-text);
    cursor: pointer;
    transition: var(--transition);
}
.dropdown-actions button:hover {
    background: var(--sidebar-accent);
    color: #fff;
}

.dropdown-list {
    overflow-y: auto;
    max-height: 200px;
    padding: 4px;
}
.dropdown-list::-webkit-scrollbar {
    width: 4px;
}
.dropdown-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
    color: var(--sidebar-text);
}
.dropdown-item:hover {
    background: rgba(255,255,255,0.08);
}
.dropdown-item input[type="checkbox"] {
    accent-color: var(--sidebar-accent);
    width: 14px;
    height: 14px;
    cursor: pointer;
}
.dropdown-item.checked {
    color: var(--sidebar-text-bright);
}

/* 필터 버튼 */
.btn-apply {
    width: 100%;
    padding: 10px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-xs);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 8px;
}
.btn-apply:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99,102,241,0.4);
}

.btn-reset {
    width: 100%;
    padding: 8px;
    background: transparent;
    color: var(--sidebar-text);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius-xs);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.btn-reset:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* 사이드바 하단 */
.sidebar-footer {
    margin-top: auto;
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-footer p {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* 사이드바 토글 (모바일) */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 200;
    width: 40px;
    height: 40px;
    background: var(--primary);
    border: none;
    border-radius: var(--radius-xs);
    color: white;
    font-size: 18px;
    cursor: pointer;
    box-shadow: var(--shadow-md);
}

/* --- 메인 콘텐츠 --- */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    padding: 24px 28px;
}

/* 빈 상태 (초기화면) */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    text-align: center;
}
.empty-state-icon {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    animation: float 3s ease-in-out infinite;
}
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}
.empty-state-icon i {
    font-size: 40px;
    color: white;
}
.empty-state h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
}
.empty-state p {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 16px;
}
.empty-state-hint {
    font-size: 13px;
    color: var(--primary);
    background: var(--primary-bg);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.empty-state-features {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
}
.feature {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 24px;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.feature i {
    font-size: 20px;
    color: var(--primary);
}
.feature span {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* 활성 필터 바 */
.active-filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--primary-bg);
    border: 1px solid #c7d2fe;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.active-filter-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.active-filter-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    flex: 1;
}
.active-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: white;
    border: 1px solid #c7d2fe;
    border-radius: 16px;
    font-size: 11px;
    color: var(--primary-dark);
    font-weight: 500;
}
.active-filter-clear {
    background: none;
    border: 1px solid var(--danger);
    color: var(--danger);
    font-size: 11px;
    font-family: inherit;
    padding: 3px 10px;
    border-radius: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: var(--transition);
    white-space: nowrap;
}
.active-filter-clear:hover {
    background: var(--danger);
    color: white;
}

/* 대시보드 헤더 */
.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.dashboard-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}
.dashboard-header h2 i {
    color: var(--primary);
}
.dashboard-header p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

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

.btn-export {
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 13px;
    font-family: inherit;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}
.btn-export:hover {
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* ★ PDF 보고서 다운로드 버튼 */
.btn-export-pdf {
    padding: 10px 20px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
    letter-spacing: 0.3px;
}
.btn-export-pdf:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}
.btn-export-pdf:active { transform: translateY(0); }

/* ★ EMP/Beehive CSV 추출 버튼 */
.btn-export-emp {
    padding: 10px 20px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
    letter-spacing: 0.3px;
}
.btn-export-emp:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
    background: linear-gradient(135deg, #059669, #047857);
}
.btn-export-emp:active { transform: translateY(0); }

/* --- KPI 카드 --- */
.kpi-section {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: flex-start;
    gap: 14px;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}
.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}
.kpi-primary::before { background: linear-gradient(90deg, var(--primary), var(--primary-light)); }
.kpi-secondary::before { background: linear-gradient(90deg, var(--secondary), var(--secondary-light)); }
.kpi-tertiary::before { background: linear-gradient(90deg, var(--tertiary), var(--tertiary-light)); }
.kpi-quaternary::before { background: linear-gradient(90deg, var(--quaternary), var(--quaternary-light)); }

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

.kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.kpi-primary .kpi-icon { background: var(--primary-bg); color: var(--primary); }
.kpi-secondary .kpi-icon { background: #fdf2f8; color: var(--secondary); }
.kpi-tertiary .kpi-icon { background: var(--success-bg); color: var(--tertiary); }
.kpi-quaternary .kpi-icon { background: var(--warning-bg); color: var(--quaternary); }

.kpi-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.kpi-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}
.kpi-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
    word-break: break-all;
}

/* KPI MoM (전월 대비) */
.kpi-mom {
    margin-top: 4px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    line-height: 1.3;
}
.kpi-mom.up { color: var(--danger); }
.kpi-mom.down { color: var(--success); }
.kpi-mom.flat { color: var(--text-muted); }
.kpi-mom .mom-detail {
    font-weight: 400;
    font-size: 10px;
    color: var(--text-muted);
}

/* --- 월별 추세 섹션 --- */
.trend-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    border-left: 4px solid var(--primary);
    margin-bottom: 24px;
    overflow: hidden;
}
.trend-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(90deg, var(--primary-bg), transparent);
}
.trend-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}
.trend-badge {
    font-size: 11px;
    font-weight: 600;
    color: var(--primary);
    background: white;
    padding: 4px 12px;
    border-radius: 16px;
    border: 1px solid #c7d2fe;
    display: flex;
    align-items: center;
    gap: 6px;
}
.trend-chart-body {
    height: 350px;
    padding: 12px;
}

/* --- 품절 임박 경고 섹션 --- */
.lowstock-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    border-left: 4px solid var(--warning);
    margin-bottom: 24px;
    overflow: hidden;
}
.lowstock-header {
    padding: 16px 20px;
    background: linear-gradient(90deg, var(--warning-bg), transparent);
    border-bottom: 1px solid var(--border-light);
}
.lowstock-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: #b45309;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.lowstock-desc {
    font-size: 12px;
    color: var(--text-secondary);
}
.badge-lowstock {
    background: #fff7ed;
    color: #c2410c;
}

/* --- 핵심 카테고리(LS) 섹션 --- */
.ls-highlight-section {
    margin-bottom: 24px;
    background: linear-gradient(135deg, #ede9fe 0%, #e0e7ff 50%, #f0e6ff 100%);
    border-radius: var(--radius);
    border: 2px solid #c4b5fd;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.12), var(--shadow-sm);
    overflow: hidden;
    position: relative;
}
.ls-highlight-section::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, #8b5cf6, #a78bfa, #c084fc, #e879f9);
}
.ls-header {
    padding: 16px 20px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.ls-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: #5b21b6;
    display: flex;
    align-items: center;
    gap: 8px;
}
.ls-header h3 i { color: #7c3aed; }
.ls-body {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 280px;
    gap: 12px;
    padding: 0 20px 20px;
    align-items: center;
}
.ls-kpi {
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(8px);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
    border: 1px solid rgba(139,92,246,0.15);
    transition: var(--transition);
}
.ls-kpi:hover {
    background: rgba(255,255,255,0.9);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.ls-kpi-label {
    font-size: 11px;
    font-weight: 600;
    color: #6d28d9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.ls-kpi-value {
    font-size: 20px;
    font-weight: 800;
    color: #5b21b6;
    line-height: 1.2;
}
.ls-kpi-sub {
    font-size: 10px;
    color: #7c3aed;
    margin-top: 4px;
    font-weight: 500;
}
.ls-chart-wrap {
    height: 180px;
    background: rgba(255,255,255,0.5);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(139,92,246,0.15);
    overflow: hidden;
}

/* 데모 버튼 */
.btn-demo {
    margin-top: 20px;
    padding: 12px 28px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(99,102,241,0.3);
}
.btn-demo:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99,102,241,0.4);
}

/* --- 차트 섹션 --- */
.charts-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.chart-container {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.chart-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.chart-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.chart-header h3 i {
    color: var(--primary);
    font-size: 14px;
}

.chart-toggle {
    display: flex;
    gap: 4px;
    background: var(--bg);
    border-radius: var(--radius-xs);
    padding: 3px;
}
.chart-btn {
    padding: 5px 12px;
    font-size: 11px;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-xs);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}
.chart-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.chart-body {
    height: 420px;
    padding: 8px;
}

/* --- 경고 섹션 --- */
.warning-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    border-left: 4px solid var(--danger);
    margin-bottom: 24px;
    overflow: hidden;
}

.warning-header {
    padding: 16px 20px;
    background: linear-gradient(90deg, var(--danger-bg), transparent);
    border-bottom: 1px solid var(--border-light);
}
.warning-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--danger);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.warning-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

/* --- 경고 테이블 스크롤 컨테이너 --- */
.warning-section .table-wrapper,
.lowstock-section .table-wrapper {
    max-height: 400px;
    overflow-y: auto;
}

/* 경고 테이블 sticky 헤더 */
.warning-section .data-table thead th,
.lowstock-section .data-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg-card);
}

/* 경고 테이블 커스텀 스크롤바 */
.warning-section .table-wrapper::-webkit-scrollbar,
.lowstock-section .table-wrapper::-webkit-scrollbar {
    width: 5px;
}
.warning-section .table-wrapper::-webkit-scrollbar-track,
.lowstock-section .table-wrapper::-webkit-scrollbar-track {
    background: transparent;
}
.warning-section .table-wrapper::-webkit-scrollbar-thumb,
.lowstock-section .table-wrapper::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}
.warning-section .table-wrapper::-webkit-scrollbar-thumb:hover,
.lowstock-section .table-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* --- 데이터 테이블 --- */
.data-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    overflow: hidden;
    margin-bottom: 24px;
}

.data-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.data-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.data-header h3 i {
    color: var(--primary);
}

.data-controls {
    display: flex;
    gap: 8px;
}
.data-controls input {
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 12px;
    font-family: inherit;
    outline: none;
    width: 200px;
    transition: var(--transition);
}
.data-controls input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
.data-controls select {
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 12px;
    font-family: inherit;
    background: white;
    cursor: pointer;
    outline: none;
}

.table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.data-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}
.data-table th {
    padding: 10px 12px;
    background: var(--bg);
    font-weight: 600;
    color: var(--text-secondary);
    text-align: left;
    white-space: nowrap;
    border-bottom: 2px solid var(--border);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.data-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: var(--transition);
}
.data-table th.sortable:hover {
    color: var(--primary);
}
.data-table th i {
    font-size: 10px;
    margin-left: 4px;
    opacity: 0.5;
}

.data-table td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
    white-space: nowrap;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.data-table td:nth-child(4) {
    max-width: 350px;
}
.data-table tbody tr {
    transition: background 0.15s;
}
.data-table tbody tr:hover {
    background: var(--primary-bg);
}

.text-right {
    text-align: right !important;
}

/* 상태 배지 */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    gap: 4px;
}
.badge-normal {
    background: var(--success-bg);
    color: var(--success);
}
.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
}
.badge-danger {
    background: var(--danger-bg);
    color: var(--danger);
}
.badge-zero {
    background: var(--bg);
    color: var(--text-muted);
}

/* 페이지네이션 */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 14px 20px;
    border-top: 1px solid var(--border-light);
}
.page-btn {
    padding: 6px 12px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}
.page-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.page-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}
.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.page-info {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0 8px;
}

/* --- 로딩 오버레이 --- */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.85);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    backdrop-filter: blur(4px);
}
.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.loading-text {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* --- 유틸리티 --- */
.hidden {
    display: none !important;
}

.number {
    font-variant-numeric: tabular-nums;
}

/* Page break for PDF */
.page-break-avoid {
    page-break-inside: avoid;
    break-inside: avoid;
}

/* --- 반응형 --- */
@media (max-width: 1200px) {
    .kpi-section {
        grid-template-columns: repeat(2, 1fr);
    }
    .charts-section {
        grid-template-columns: 1fr;
    }
    .ls-body {
        grid-template-columns: repeat(3, 1fr);
    }
    .ls-chart-wrap {
        grid-column: 1 / -1;
        height: 220px;
    }
    .header-actions {
        flex-direction: column;
        width: 100%;
    }
    .btn-export-pdf,
    .btn-export-emp {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    /* ===== 사이드바 Off-canvas ===== */
    .sidebar {
        transform: translateX(-100%);
        width: 85vw;
        max-width: 320px;
        box-shadow: 4px 0 24px rgba(0,0,0,0.3);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
    }

    /* ===== 메인 콘텐츠 ===== */
    .main-content {
        margin-left: 0;
        padding: 12px;
        padding-top: 60px;
    }

    /* ===== KPI 카드 1열 세로 배치 ===== */
    .kpi-section {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .kpi-card {
        padding: 16px;
    }
    .kpi-value {
        font-size: 18px;
    }
    .kpi-label {
        font-size: 11px;
    }

    /* ===== 차트 1열 세로 배치 ===== */
    .charts-section {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .chart-body {
        height: 300px;
    }
    .chart-header {
        padding: 12px 14px;
        flex-wrap: wrap;
        gap: 8px;
    }
    .chart-header h3 {
        font-size: 13px;
    }

    /* ===== LS 섹션 1열 ===== */
    .ls-body {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .ls-chart-wrap {
        height: 200px;
    }
    .ls-kpi-value {
        font-size: 18px;
    }
    .ls-header {
        padding: 12px 14px 8px;
    }
    .ls-header h3 {
        font-size: 13px;
    }

    /* ===== 추세 차트 ===== */
    .trend-chart-body {
        height: 260px;
        padding: 8px;
    }
    .trend-header {
        padding: 12px 14px;
        flex-wrap: wrap;
        gap: 8px;
    }

    /* ===== 데이터 테이블: 가로 스와이프 ===== */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .data-table {
        min-width: 800px;
    }
    .data-table th,
    .data-table td {
        white-space: nowrap;
    }

    /* ===== 데이터 섹션 컨트롤 ===== */
    .data-header {
        padding: 12px 14px;
    }
    .data-controls {
        flex-direction: column;
        width: 100%;
        gap: 6px;
    }
    .data-controls input {
        width: 100%;
        min-height: 44px;
        font-size: 14px;
    }
    .data-controls select {
        width: 100%;
        min-height: 44px;
        font-size: 14px;
    }

    /* ===== 대시보드 헤더 ===== */
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        margin-bottom: 16px;
    }
    .dashboard-header h2 {
        font-size: 16px;
    }
    .dashboard-header p {
        font-size: 11px;
    }
    .header-actions {
        flex-direction: column;
        width: 100%;
        gap: 6px;
    }
    .btn-export-pdf,
    .btn-export-emp,
    .btn-export-share,
    .btn-export {
        width: 100%;
        justify-content: center;
        font-size: 12px;
        padding: 10px 14px;
        min-height: 44px;
    }
    .dark-mode-toggle {
        width: 44px;
        height: 44px;
    }

    /* ===== 터치 친화적 UI (최소 44px 터치 영역) ===== */
    .btn-apply {
        min-height: 44px;
        font-size: 14px;
    }
    .btn-reset {
        min-height: 44px;
        font-size: 13px;
    }
    .sidebar-search-input {
        min-height: 44px;
        font-size: 14px;
        padding: 10px 14px;
    }
    .sidebar-select {
        min-height: 44px;
        font-size: 14px;
        padding: 10px 14px;
    }
    .multi-select-header {
        min-height: 44px;
        font-size: 13px;
        padding: 10px 14px;
    }
    .status-checkbox {
        min-height: 44px;
        padding: 8px 0;
    }
    .status-checkbox input[type="checkbox"] {
        width: 20px;
        height: 20px;
    }
    .status-checkbox .badge {
        font-size: 13px;
    }
    .dropdown-item {
        min-height: 44px;
        padding: 10px 12px;
        font-size: 13px;
    }
    .dropdown-item input[type="checkbox"] {
        width: 20px;
        height: 20px;
    }
    .dropdown-actions button {
        min-height: 40px;
        font-size: 13px;
    }
    .dropdown-search input {
        min-height: 40px;
        font-size: 14px;
    }
    .btn-barcode-scan {
        width: 44px;
        height: 44px;
        font-size: 16px;
    }
    .filter-group label {
        font-size: 13px;
        min-height: 32px;
    }

    /* ===== 페이지네이션 터치 ===== */
    .page-btn {
        min-width: 40px;
        min-height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 13px;
    }
    .pagination {
        flex-wrap: wrap;
        gap: 6px;
        padding: 12px 14px;
    }

    /* ===== 경고/품절 섹션 ===== */
    .warning-header,
    .lowstock-header {
        padding: 12px 14px;
    }
    .warning-header h3,
    .lowstock-header h3 {
        font-size: 13px;
    }
    .warning-desc,
    .lowstock-desc {
        font-size: 11px;
    }

    /* ===== 월별 비교 섹션 ===== */
    .month-compare-header {
        padding: 12px 14px;
        flex-wrap: wrap;
        gap: 8px;
    }
    .month-compare-header h3 {
        font-size: 13px;
    }

    /* ===== 활성 필터 바 ===== */
    .active-filter-bar {
        padding: 8px 12px;
        gap: 6px;
    }
    .active-filter-tag {
        font-size: 10px;
        padding: 4px 8px;
    }

    /* ===== 빈 상태 화면 ===== */
    .empty-state {
        padding: 20px;
        min-height: 60vh;
    }
    .empty-state h2 {
        font-size: 18px;
    }
    .empty-state p {
        font-size: 13px;
    }
    .empty-state-icon {
        width: 80px;
        height: 80px;
    }
    .empty-state-icon i {
        font-size: 32px;
    }
    .empty-state-features {
        flex-direction: column;
        gap: 8px;
    }
    .feature {
        padding: 12px 20px;
        flex-direction: row;
        gap: 10px;
    }
    .btn-demo {
        width: 100%;
        justify-content: center;
        min-height: 44px;
    }

    /* ===== 릴리즈 캘린더 ===== */
    .release-calendar-header {
        padding: 12px 14px;
        flex-wrap: wrap;
        gap: 8px;
    }
    .release-calendar-header h3 {
        font-size: 13px;
    }
    .release-calendar-body {
        padding: 12px 14px;
    }
    .release-item {
        width: 156px;
    }

    /* ===== Toast 위치 모바일 ===== */
    .toast {
        left: 16px;
        right: 16px;
        bottom: 16px;
        width: auto;
    }

    /* ===== 위젯 드래그 핸들 - 항상 보이기 ===== */
    .widget-drag-handle {
        opacity: 1;
    }

    /* ===== Body scroll lock when sidebar open ===== */
    body.sidebar-open {
        overflow: hidden;
    }
}

/* 사이드바 오픈 시 오버레이 */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 90;
}
@media (max-width: 768px) {
    .sidebar-overlay.show {
        display: block;
    }
}

/* 토스트 알림 */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    background: var(--text);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 13px;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    animation: slideInToast 0.3s ease, fadeOutToast 0.3s ease 2.7s;
    display: flex;
    align-items: center;
    gap: 8px;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }

@keyframes slideInToast {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes fadeOutToast {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ===== PDF / Print 관련 스타일 ===== */
.pdf-hide {
    /* PDF 생성 시 JS로 display:none 처리 — 의도적 빈 블록 */
    visibility: visible;
}

/* PDF 보고서 헤더 (JS에서 동적 삽입) */
.pdf-report-header {
    text-align: center;
    padding: 28px 24px 20px;
    border-bottom: 3px solid #6366f1;
    margin-bottom: 24px;
    background: linear-gradient(135deg, #eef2ff, #f8fafc);
    border-radius: 12px;
}
.pdf-report-header h1 {
    font-size: 22px;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 8px;
    font-family: 'Noto Sans KR', sans-serif;
}
.pdf-report-header .pdf-subtitle {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 4px;
}
.pdf-report-header .pdf-date {
    font-size: 12px;
    color: #94a3b8;
}

/* --- 검색창 + 바코드 스캔 래퍼 --- */
.search-with-scan {
    display: flex;
    gap: 6px;
    align-items: center;
}
.search-with-scan .sidebar-search-input {
    flex: 1;
    min-width: 0;
}
.btn-barcode-scan {
    width: 36px; height: 36px;
    border-radius: var(--radius-xs);
    border: 1px solid rgba(255,255,255,0.2);
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    font-size: 14px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}
.btn-barcode-scan:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99,102,241,0.4);
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
}

/* --- K-Biz 릴리즈 캘린더 위젯 --- */
.release-calendar-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    border-left: 4px solid #f59e0b;
    margin-bottom: 24px;
    overflow: hidden;
}
.release-calendar-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex; align-items: center; justify-content: space-between;
    background: linear-gradient(90deg, rgba(245,158,11,0.08), transparent);
}
.release-calendar-header h3 {
    font-size: 15px; font-weight: 700; color: #b45309;
    display: flex; align-items: center; gap: 8px;
}
.release-badge {
    font-size: 11px; font-weight: 600; color: #b45309;
    background: #fffbeb; padding: 4px 12px; border-radius: 16px;
    border: 1px solid #fde68a;
    display: flex; align-items: center; gap: 6px;
}
.release-calendar-body {
    padding: 16px 20px;
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overflow-y: auto;
    max-height: 300px;
    flex-wrap: wrap;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
}
.release-calendar-body::-webkit-scrollbar { width: 4px; height: 4px; }
.release-calendar-body::-webkit-scrollbar-track { background: transparent; }
.release-calendar-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.release-calendar-body::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.release-item {
    flex: 0 0 auto;
    width: 176px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    padding: 14px 16px;
    cursor: pointer;
    transition: var(--transition);
    scroll-snap-align: start;
    position: relative;
    overflow: hidden;
}
.release-item::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.release-item[data-type="앨범"]::before { background: linear-gradient(90deg, #6366f1, #a78bfa); }
.release-item[data-type="MD/앨범"]::before { background: linear-gradient(90deg, #ec4899, #f472b6); }
.release-item[data-type="MD"]::before { background: linear-gradient(90deg, #10b981, #34d399); }
.release-item[data-type="콘서트MD"]::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }

.release-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}
.release-item-date {
    font-size: 11px; font-weight: 700; color: var(--primary);
    margin-bottom: 8px;
    display: flex; align-items: center; gap: 5px;
}
.release-item-date i { font-size: 10px; }
.release-item-artist {
    font-size: 14px; font-weight: 800;
    color: var(--text);
    margin-bottom: 4px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.release-item-title {
    font-size: 11px; color: var(--text-secondary);
    margin-bottom: 8px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.release-item-type {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 10px; font-weight: 600;
    padding: 2px 8px; border-radius: 10px;
}
.release-item-type[data-type="앨범"] { background: var(--primary-bg); color: var(--primary); }
.release-item-type[data-type="MD/앨범"] { background: #fdf2f8; color: #db2777; }
.release-item-type[data-type="MD"] { background: var(--success-bg); color: var(--success); }
.release-item-type[data-type="콘서트MD"] { background: var(--warning-bg); color: #b45309; }

.release-item-dday {
    position: absolute; top: 10px; right: 10px;
    font-size: 9px; font-weight: 700;
    padding: 2px 6px; border-radius: 8px;
    background: var(--danger-bg); color: var(--danger);
}
.release-item-dday.soon { background: #fef3c7; color: #b45309; }
.release-item-dday.future { background: var(--primary-bg); color: var(--primary); }

/* 릴리즈 캘린더 다크 모드 */
[data-theme="dark"] .release-calendar-header {
    background: linear-gradient(90deg, rgba(245,158,11,0.1), transparent);
}
[data-theme="dark"] .release-calendar-header h3 { color: #fbbf24; }
[data-theme="dark"] .release-badge { background: rgba(245,158,11,0.15); border-color: #92400e; color: #fbbf24; }
[data-theme="dark"] .release-item { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .release-item:hover { border-color: var(--primary); }
[data-theme="dark"] .release-item-type[data-type="앨범"] { background: rgba(99,102,241,0.15); }
[data-theme="dark"] .release-item-type[data-type="MD/앨범"] { background: rgba(236,72,153,0.15); }
[data-theme="dark"] .release-item-type[data-type="MD"] { background: rgba(16,185,129,0.15); }
[data-theme="dark"] .release-item-type[data-type="콘서트MD"] { background: rgba(245,158,11,0.15); }

/* --- 메신저 공유 버튼 --- */
.btn-export-share {
    padding: 10px 20px;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    display: flex; align-items: center; gap: 8px;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
    letter-spacing: 0.3px;
}
.btn-export-share:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.4);
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
}
.btn-export-share:active { transform: translateY(0); }

/* --- 바코드/QR 스캐너 모달 --- */
.barcode-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 3000;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(4px);
    animation: fadeInModal 0.2s ease;
}
@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}
.barcode-modal {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    width: 90%;
    max-width: 480px;
    overflow: hidden;
    animation: slideUpModal 0.3s ease;
}
@keyframes slideUpModal {
    from { transform: translateY(40px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.barcode-modal-header {
    padding: 16px 20px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--border-light);
    background: linear-gradient(90deg, rgba(99,102,241,0.08), transparent);
}
.barcode-modal-header h3 {
    font-size: 16px; font-weight: 700; color: var(--text);
    display: flex; align-items: center; gap: 8px;
}
.barcode-modal-close {
    width: 32px; height: 32px;
    border-radius: 50%; border: none;
    background: var(--bg); color: var(--text-secondary);
    font-size: 14px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.barcode-modal-close:hover {
    background: var(--danger-bg); color: var(--danger);
}
.barcode-modal-body {
    padding: 20px;
}
#barcodeScannerView {
    width: 100%;
    min-height: 300px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #000;
}
.barcode-hint {
    margin-top: 12px;
    font-size: 12px; color: var(--text-secondary);
    text-align: center;
    display: flex; align-items: center; justify-content: center; gap: 6px;
}

/* 바코드 모달 다크 모드 */
[data-theme="dark"] .barcode-modal { background: #1e293b; }
[data-theme="dark"] .barcode-modal-header { background: linear-gradient(90deg, rgba(99,102,241,0.12), transparent); }
[data-theme="dark"] .barcode-modal-close { background: #0f172a; }

/* ================================================
   ★ 대량 바코드/상품코드 다중 검색 팝업 모달
   ================================================ */
.bulk-search-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 3100;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(4px);
    animation: fadeInModal 0.2s ease;
}
.bulk-search-modal {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    width: 92%;
    max-width: 560px;
    overflow: hidden;
    animation: slideUpModal 0.3s ease;
}
.bulk-search-header {
    padding: 16px 20px;
    display: flex; align-items: center; gap: 12px;
    border-bottom: 1px solid var(--border-light);
    background: linear-gradient(90deg, rgba(99,102,241,0.08), rgba(236,72,153,0.05), transparent);
}
.bulk-search-header h3 {
    font-size: 16px; font-weight: 700; color: var(--text);
    display: flex; align-items: center; gap: 8px;
    flex: 1; margin: 0;
}
.bulk-search-shortcut-badge {
    display: flex; align-items: center; gap: 4px;
    font-size: 11px; color: var(--text-muted);
}
.bulk-search-shortcut-badge kbd {
    display: inline-block;
    padding: 2px 6px;
    font-size: 10px; font-weight: 600; font-family: inherit;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-secondary);
    box-shadow: 0 1px 0 var(--border);
}
.bulk-search-close {
    width: 32px; height: 32px;
    border-radius: 50%; border: none;
    background: var(--bg); color: var(--text-secondary);
    font-size: 14px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}
.bulk-search-close:hover {
    background: var(--danger-bg); color: var(--danger);
}
.bulk-search-body {
    padding: 20px;
}
.bulk-search-desc {
    font-size: 13px; color: var(--text-secondary);
    margin: 0 0 14px 0;
    line-height: 1.7;
    display: flex; gap: 8px;
}
.bulk-search-desc i {
    color: var(--primary); flex-shrink: 0; margin-top: 3px;
}
.bulk-search-desc strong {
    color: var(--text); font-weight: 600;
}
#bulkSearchInput {
    width: 100%;
    min-height: 180px;
    padding: 14px 16px;
    font-size: 13px; font-family: 'Noto Sans KR', monospace;
    line-height: 1.7;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    resize: vertical;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}
#bulkSearchInput:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
#bulkSearchInput::placeholder {
    color: var(--text-muted);
    font-size: 12px;
}
.bulk-search-info {
    display: flex; align-items: center; justify-content: space-between;
    margin: 10px 0 16px;
    font-size: 12px; color: var(--text-muted);
}
.bulk-search-active-tag {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px;
    background: var(--primary-bg);
    color: var(--primary);
    border-radius: 20px;
    font-size: 11px; font-weight: 600;
}
.bulk-search-actions {
    display: flex; gap: 10px;
}
.bulk-btn {
    flex: 1;
    padding: 10px 16px;
    font-size: 13px; font-weight: 600; font-family: inherit;
    border: none; border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    transition: var(--transition);
}
.bulk-btn-primary {
    background: var(--primary);
    color: #fff;
}
.bulk-btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}
.bulk-btn-warning {
    background: var(--warning-bg);
    color: #b45309;
}
.bulk-btn-warning:hover {
    background: #fef3c7;
}
.bulk-btn-secondary {
    background: var(--bg);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.bulk-btn-secondary:hover {
    background: var(--border-light);
}

/* 대량 검색 모달 다크 모드 */
[data-theme="dark"] .bulk-search-modal { background: #1e293b; }
[data-theme="dark"] .bulk-search-header { background: linear-gradient(90deg, rgba(99,102,241,0.12), rgba(236,72,153,0.06), transparent); }
[data-theme="dark"] .bulk-search-close { background: #0f172a; }
[data-theme="dark"] #bulkSearchInput { background: #0f172a; border-color: #334155; color: #e2e8f0; }
[data-theme="dark"] #bulkSearchInput:focus { border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(129,140,248,0.15); }
[data-theme="dark"] #bulkSearchInput::placeholder { color: #64748b; }
[data-theme="dark"] .bulk-search-desc { color: #94a3b8; }
[data-theme="dark"] .bulk-search-shortcut-badge kbd { background: #0f172a; border-color: #334155; color: #94a3b8; box-shadow: 0 1px 0 #0f172a; }
[data-theme="dark"] .bulk-btn-warning { background: rgba(245,158,11,0.12); color: #fbbf24; }
[data-theme="dark"] .bulk-btn-warning:hover { background: rgba(245,158,11,0.2); }
[data-theme="dark"] .bulk-btn-secondary { background: #0f172a; color: #94a3b8; border-color: #334155; }
[data-theme="dark"] .bulk-btn-secondary:hover { background: #1e293b; }

/* 대량 검색 모달 반응형 */
@media (max-width: 768px) {
    .bulk-search-modal {
        width: 95%;
        max-width: none;
    }
    .bulk-search-shortcut-badge {
        display: none;
    }
    .bulk-search-close {
        width: 44px;
        height: 44px;
        font-size: 16px;
    }
    .bulk-search-actions {
        flex-direction: column;
    }
    #bulkSearchInput {
        min-height: 150px;
        font-size: 14px;
    }
}

/* 반응형 - 바코드 모바일 전용 (기타 768px 규칙은 메인 반응형 블록에 통합) */
@media (max-width: 768px) {
    .barcode-modal {
        width: 95%;
        max-width: none;
    }
    #barcodeScannerView {
        min-height: 250px;
    }
    .barcode-modal-close {
        width: 44px;
        height: 44px;
        font-size: 16px;
    }
}

@media print {
    .sidebar,
    .sidebar-toggle,
    .sidebar-overlay,
    .pdf-hide,
    .header-actions,
    .dashboard-header,
    .data-section,
    .pagination,
    .btn-demo,
    .empty-state {
        display: none !important;
    }
    body {
        display: block;
        background: white;
    }
    .main-content {
        margin-left: 0;
        padding: 0;
    }
    .kpi-card, .chart-container, .warning-section, .lowstock-section, .ls-highlight-section, .trend-section {
        page-break-inside: avoid;
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #e2e8f0;
    }
    .charts-section {
        page-break-before: always;
    }
}
/* =========================================================
   📱 모바일 화면 강제 최적화 (화면 잘림 완벽 방지)
   ========================================================= */
@media (max-width: 768px) {
    /* 1. 가로 스크롤 원천 차단 및 전체 너비 맞춤 */
    html, body {
        overflow-x: hidden !important;
        width: 100% !important;
        margin: 0;
        padding: 0;
    }

    /* 2. 메인 컨테이너 및 섹션 너비 100% 강제 */
    .main-content, .dashboard-container, .dashboard, .upload-section {
        width: 100% !important;
        min-width: 100% !important;
        padding: 10px !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }

    /* 3. KPI 카드, 차트를 세로로 한 줄(1 Column) 배치 */
    .kpi-section, .charts-section, .grid-container, .chart-row, .flex-row {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        gap: 15px !important;
    }

    /* 4. 개별 카드 및 차트가 화면에 꽉 차게 변경 */
    .kpi-card, .chart-container, .widget-item, .upload-area, #dropZone {
        width: 100% !important;
        max-width: 100% !important;
        min-width: unset !important;
        box-sizing: border-box !important;
        margin: 0 !important;
    }

    /* 5. 하단 데이터 테이블은 표가 찌그러지지 않게 가로 스크롤 허용 */
    .table-responsive, .table-container, .data-section {
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch; /* 아이폰 부드러운 스크롤 */
    }

    /* 표 최소 너비 유지 (가로로 스와이프해서 볼 수 있게) */
    table {
        min-width: 800px !important; 
    }
}
