/* ==========================================================================
   외부입출내역 (External Logistics) ECOUNT ERP 고밀도 스타일시트
   입출고내역 시스템 완벽 동기화 + 차세대 스프레드시트 고도화 테마
   ========================================================================== */

:root {
    --erp-primary: #2563eb;
    --erp-primary-hover: #1d4ed8;
    --erp-primary-light: #eff6ff;
    --erp-success: #10b981;
    --erp-warning: #f59e0b;
    --erp-danger: #ef4444;
    --erp-dark: #1e293b;
    --erp-header-bg: #1e293b;
    --erp-th-bg: #f8fafc;
    --erp-border: #cbd5e1;
    --erp-border-light: #e2e8f0;
    --erp-text: #1e293b;
    --erp-text-muted: #64748b;
    --erp-row-hover: #f1f5f9;
    --erp-row-active: #e2e8f0;
    --erp-row-height: 26px;
    --erp-font-size: 11.5px;
}

/* 기본 레이아웃 (여백 최소화 & 고밀도 화면 활용) */
body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f8fafc;
    color: var(--erp-text);
    margin: 0;
    padding: 6px 10px;
    font-size: var(--erp-font-size);
    line-height: 1.35;
    -webkit-font-smoothing: antialiased;
}

/* ── 1. ECOUNT ERP 1행 탑 툴바 (.erp-top-toolbar) ── */
.erp-top-toolbar {
    background: #ffffff;
    border: 1px solid var(--erp-border);
    border-radius: 2px;
    padding: 4px 8px;
    min-height: 34px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.erp-title-tag {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding-right: 10px;
    border-right: 1px solid var(--erp-border-light);
    letter-spacing: -0.3px;
}

/* 탭 버튼 그룹 */
.erp-tab-group {
    display: inline-flex;
    gap: 2px;
    background: #f1f5f9;
    padding: 2px;
    border-radius: 2px;
}

.erp-tab-btn {
    padding: 2px 9px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid transparent;
    border-radius: 2px;
    background: transparent;
    color: var(--erp-text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    line-height: 18px;
    user-select: none;
}

.erp-tab-btn:hover {
    color: #0f172a;
    background: rgba(255, 255, 255, 0.7);
}

.erp-tab-btn.active,
.btn-check:checked + .erp-tab-btn {
    background: #ffffff !important;
    color: var(--erp-primary) !important;
    border-color: var(--erp-border-light) !important;
    font-weight: 700 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* ERP 액션 버튼 규격 */
.btn-erp {
    height: 24px;
    padding: 0 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 2px;
    border: 1px solid var(--erp-border);
    background: #ffffff;
    color: #334155;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.12s ease;
    white-space: nowrap;
    text-decoration: none;
    box-sizing: border-box;
}

.btn-erp:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #0f172a;
}

.btn-erp-primary {
    background: var(--erp-primary) !important;
    border-color: var(--erp-primary) !important;
    color: #ffffff !important;
}
.btn-erp-primary:hover {
    background: var(--erp-primary-hover) !important;
    border-color: var(--erp-primary-hover) !important;
}

.btn-erp-success {
    background: #15803d !important;
    border-color: #15803d !important;
    color: #ffffff !important;
}
.btn-erp-success:hover {
    background: #166534 !important;
}

.btn-erp-warning {
    background: #d97706 !important;
    border-color: #d97706 !important;
    color: #ffffff !important;
}
.btn-erp-warning:hover {
    background: #b45309 !important;
}

.btn-erp-danger {
    background: #dc2626 !important;
    border-color: #dc2626 !important;
    color: #ffffff !important;
}
.btn-erp-danger:hover {
    background: #b91c1c !important;
}

/* ── 2. ECOUNT ERP 2행 필터 리본 (.erp-filter-ribbon) ── */
.erp-filter-ribbon {
    background: #ffffff;
    border: 1px solid var(--erp-border);
    border-radius: 2px;
    padding: 4px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 4px;
}

/* 기간 프리셋 버튼 그룹 */
.erp-preset-group .btn,
.erp-preset-btn {
    height: 24px !important;
    padding: 0 7px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    border-radius: 0 !important;
    border-color: var(--erp-border) !important;
    color: #475569 !important;
    background: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.12s ease;
}

.erp-preset-group .btn:hover,
.erp-preset-btn:hover {
    background: #f1f5f9 !important;
    color: #0f172a !important;
}

.erp-preset-group .btn.active,
.erp-preset-group .btn.btn-primary,
.erp-preset-btn.active {
    background-color: var(--erp-primary) !important;
    border-color: var(--erp-primary) !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.25) !important;
    z-index: 2;
}

.erp-input-date {
    height: 24px !important;
    font-size: 11.5px !important;
    padding: 0 6px !important;
    width: 118px !important;
    border-radius: 2px !important;
    border: 1px solid var(--erp-border) !important;
    color: #1e293b !important;
}

.erp-select-target {
    height: 24px !important;
    font-size: 11.5px !important;
    padding: 0 20px 0 6px !important;
    width: 105px !important;
    border-radius: 2px !important;
    border: 1px solid var(--erp-border) !important;
    color: #1e293b !important;
    background-position: right 4px center !important;
}

.erp-search-box input {
    height: 24px !important;
    font-size: 11.5px !important;
    padding: 0 24px 0 8px !important;
    width: 200px !important;
    border-radius: 2px !important;
    border: 1px solid var(--erp-border) !important;
}

.erp-subsearch-group input {
    height: 24px !important;
    font-size: 11.5px !important;
    padding: 0 6px !important;
    width: 130px !important;
}

/* ── 3. 실시간 요약 집계 스트립 (.erp-summary-strip) ── */
.erp-summary-strip {
    background: #f8fafc;
    border: 1px solid var(--erp-border);
    border-radius: 2px;
    padding: 3px 10px;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11.5px;
    color: #475569;
}

.erp-summary-items {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.erp-summary-item strong {
    color: #0f172a;
    font-weight: 700;
    margin-left: 2px;
}

.erp-summary-item.highlight strong {
    color: var(--erp-primary);
    font-size: 12px;
}

/* ── 4. ECOUNT ERP 초고밀도 그리드 테이블 (.erp-grid-wrapper & .erp-sheet-table) ── */
.erp-grid-wrapper {
    background: #ffffff;
    border: 1px solid var(--erp-border);
    border-radius: 2px;
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(100vh - 150px);
    position: relative;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.erp-sheet-table {
    width: 100%;
    max-width: none;
    border-collapse: collapse !important;
    font-size: var(--erp-font-size);
    table-layout: fixed !important;
    margin: 0 !important;
    border: 1px solid var(--erp-border) !important;
    background-color: var(--erp-border) !important;
}

.erp-sheet-table thead th {
    background-color: var(--erp-th-bg) !important;
    background-clip: padding-box !important;
    color: #1e293b !important;
    font-weight: 700 !important;
    text-align: center !important;
    vertical-align: middle !important;
    padding: 2px 4px !important;
    font-size: 11px !important;
    border: 1px solid var(--erp-border) !important;
    white-space: nowrap !important;
    position: sticky !important;
    top: 0;
    z-index: 10;
    height: var(--erp-row-height) !important;
    line-height: 1.2 !important;
    user-select: none;
    cursor: pointer;
    overflow: visible !important;
}

.erp-sheet-table thead th:hover {
    background-color: #edf2f7 !important;
}

.erp-sheet-table tbody td {
    padding: 0 5px !important;
    border: 1px solid var(--erp-border) !important;
    vertical-align: middle !important;
    background-color: #ffffff;
    background-clip: padding-box !important;
    height: var(--erp-row-height) !important;
    line-height: var(--erp-row-height) !important;
    box-sizing: border-box !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: var(--erp-font-size);
}

.erp-sheet-table tbody tr:hover td {
    background-color: var(--erp-row-hover) !important;
}

.erp-sheet-table tbody tr.is-selected td {
    background-color: #eff6ff !important;
}

/* 읽기 전용 / 번호 / 체크박스 열 */
.erp-sheet-table th.th-check,
.erp-sheet-table td.td-check,
.erp-sheet-table th.th-no,
.erp-sheet-table td.td-no {
    text-align: center !important;
    padding: 0 !important;
    width: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
}

.erp-sheet-table th.th-date, .erp-sheet-table td.td-date { width: 85px; min-width: 85px; text-align: center; }
.erp-sheet-table th.th-voucher, .erp-sheet-table td.td-voucher { width: 125px; min-width: 125px; text-align: center; }
.erp-sheet-table th.th-category, .erp-sheet-table td.td-category { width: 75px; min-width: 75px; text-align: center; }
.erp-sheet-table th.th-supplier, .erp-sheet-table td.td-supplier { width: 140px; min-width: 120px; }
.erp-sheet-table th.th-destination, .erp-sheet-table td.td-destination { width: 150px; min-width: 130px; }
.erp-sheet-table th.th-item, .erp-sheet-table td.td-item { width: 160px; min-width: 140px; font-weight: 600; }
.erp-sheet-table th.th-spec, .erp-sheet-table td.td-spec { width: 130px; min-width: 110px; }
.erp-sheet-table th.th-unit, .erp-sheet-table td.td-unit { width: 45px; min-width: 45px; text-align: center; }
.erp-sheet-table th.th-qty, .erp-sheet-table td.td-qty { width: 65px; min-width: 60px; text-align: right; }
.erp-sheet-table th.th-price, .erp-sheet-table td.td-price { width: 80px; min-width: 75px; text-align: right; }
.erp-sheet-table th.th-supply, .erp-sheet-table td.td-supply { width: 95px; min-width: 90px; text-align: right; font-weight: 600; }
.erp-sheet-table th.th-vat, .erp-sheet-table td.td-vat { width: 80px; min-width: 75px; text-align: right; }
.erp-sheet-table th.th-total, .erp-sheet-table td.td-total { width: 105px; min-width: 95px; text-align: right; font-weight: 700; color: #0369a1; }
.erp-sheet-table th.th-memo, .erp-sheet-table td.td-memo { width: 150px; min-width: 120px; }
.erp-sheet-table th.th-action, .erp-sheet-table td.td-action { width: 55px; min-width: 55px; text-align: center; }

/* 열 리사이저 */
.col-resizer {
    position: absolute;
    top: 0;
    right: -3px;
    width: 7px;
    height: 100%;
    cursor: col-resize !important;
    user-select: none;
    z-index: 25;
    display: flex;
    justify-content: center;
}
.col-resizer::after {
    content: '';
    width: 2px;
    height: 100%;
    background-color: transparent;
    transition: background-color 0.1s ease;
}
.col-resizer:hover::after,
.col-resizer.is-resizing::after {
    background-color: var(--erp-primary);
}

/* ── 5. 메인 그리드 인라인 퀵 수정 (.is-inline-editing) ── */
.is-inline-editable {
    cursor: cell;
}
.is-inline-editable:hover {
    box-shadow: inset 0 0 0 1px #93c5fd !important;
}

td.is-inline-editing {
    padding: 0 !important;
    box-shadow: inset 0 0 0 2px var(--erp-primary) !important;
    background-color: #ffffff !important;
    z-index: 15 !important;
}

.erp-inline-input {
    width: 100% !important;
    height: var(--erp-row-height) !important;
    border: none !important;
    outline: none !important;
    padding: 0 5px !important;
    font-size: var(--erp-font-size) !important;
    color: #0f172a !important;
    background: transparent !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}
.erp-inline-input.text-end { text-align: right !important; }
.erp-inline-input.text-center { text-align: center !important; }

/* ── 6. 스프레드시트 셀 인풋 (.erp-cell-input) ── */
.erp-cell-input {
    width: 100% !important;
    height: 100% !important;
    min-height: 24px;
    border: none !important;
    outline: none !important;
    padding: 1px 5px !important;
    font-size: var(--erp-font-size) !important;
    background: transparent !important;
    color: #1e293b;
    border-radius: 0 !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
}
.erp-cell-input:focus {
    box-shadow: none !important;
    outline: none !important;
}
.erp-cell-input.text-end { text-align: right !important; }
.erp-cell-input.text-center { text-align: center !important; }
.erp-cell-input[readonly], .erp-cell-input.bg-readonly {
    background: #f8fafc !important;
    color: #475569 !important;
    cursor: default !important;
}

.erp-sheet-table tbody td:focus-within {
    box-shadow: inset 0 0 0 2px var(--erp-primary) !important;
    background-color: #eff6ff !important;
    position: relative;
    z-index: 5;
}

/* 행 삭제 버튼 */
.btn-row-del {
    width: 100% !important;
    height: 24px !important;
    border: none !important;
    background: transparent !important;
    color: #94a3b8 !important;
    font-size: 15px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
.btn-row-del:hover {
    color: var(--erp-danger) !important;
    background-color: #fee2e2 !important;
}

/* ── 7. 전표형 고속 스프레드시트 모달 (.erp-window-header, .erp-form-table) ── */
.erp-window-header {
    background: var(--erp-header-bg) !important;
    color: #f8fafc !important;
    padding: 6px 12px !important;
    border-bottom: 2px solid #0f172a !important;
    border-radius: 0 !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.erp-window-title {
    font-size: 13.5px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.3px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.erp-window-header .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
    opacity: 0.8;
}
.erp-window-header .btn-close:hover {
    opacity: 1;
}

/* 전표 마스터 정보 폼 테이블 */
.erp-form-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    background: #ffffff;
    border: 1px solid var(--erp-border);
    margin-bottom: 6px;
}
.erp-form-table th {
    background-color: #f8fafc;
    color: #334155;
    font-size: 11.5px;
    font-weight: 600;
    padding: 2px 8px;
    border: 1px solid var(--erp-border);
    white-space: nowrap;
    vertical-align: middle;
    text-align: center;
    height: 26px;
}
.erp-form-table td {
    padding: 0;
    border: 1px solid var(--erp-border);
    vertical-align: middle;
    background-color: #ffffff;
    height: 26px;
}
.erp-form-table .form-control,
.erp-form-table .form-select {
    width: 100%;
    height: 26px !important;
    font-size: 12px !important;
    padding: 2px 6px !important;
    border-radius: 0 !important;
    border: none !important;
    outline: none !important;
    color: #1e293b;
    background: transparent !important;
    box-shadow: none !important;
}
.erp-form-table td:focus-within {
    box-shadow: inset 0 0 0 2px var(--erp-primary) !important;
    background-color: #eff6ff !important;
    position: relative !important;
    z-index: 5 !important;
}

/* 전표 스프레드시트 툴바 & 요약 */
.erp-grid-toolbar {
    background: #f8fafc;
    border: 1px solid var(--erp-border);
    border-bottom: none;
    padding: 4px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11.5px;
}
.erp-summary-panel {
    background: #f1f5f9 !important;
    border: 1px solid var(--erp-border) !important;
    border-radius: 0 !important;
    padding: 6px 12px !important;
    margin-top: 4px !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* 엑셀 붙여넣기 팁 뱃지 */
.excel-paste-badge {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
    padding: 2px 6px;
    border-radius: 2px;
    font-size: 10.5px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* 스마트 메모리 자동제안 힌트 배지 */
.smart-memory-badge {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
    padding: 1px 5px;
    border-radius: 2px;
    font-size: 10.5px;
    font-weight: 600;
}

/* 자동완성 드롭다운 (ECOUNT 고밀도 레이아웃) */
.autocomplete-suggestions {
    border: 1px solid #94a3b8;
    max-height: 200px;
    overflow-y: auto;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1090;
    background: #ffffff;
    width: 100%;
    border-radius: 2px;
    display: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}
.autocomplete-suggestion {
    padding: 4px 8px;
    cursor: pointer;
    font-size: 11.5px;
    color: #1e293b;
    border-bottom: 1px solid #f1f5f9;
}
.autocomplete-suggestion:hover,
.autocomplete-suggestion.active {
    background-color: #eff6ff;
    color: var(--erp-primary);
    font-weight: 600;
}

/* ── 8. 통계 대시보드 뷰 고밀도 콤팩트 스타일 ── */
#tabDashboardView {
    padding-top: 4px;
}
.dashboard-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
    margin-bottom: 8px;
}
@media (max-width: 1350px) and (min-width: 768px) {
    .dashboard-kpi-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
.kpi-card {
    background: #ffffff;
    border: 1px solid var(--erp-border);
    border-radius: 2px;
    padding: 8px 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}
.kpi-card .kpi-title {
    font-size: 11px;
    color: var(--erp-text-muted);
    margin-bottom: 2px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.kpi-card .kpi-val {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

.chart-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
}
@media (max-width: 992px) {
    .chart-grid { grid-template-columns: 1fr; }
}
.chart-box {
    background: #ffffff;
    border: 1px solid var(--erp-border);
    border-radius: 2px;
    padding: 10px;
}
.chart-box h3 {
    font-size: 12px;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* 대시보드 순위 테이블 정렬 및 출고처 뱃지 스타일 */
.th-dash-sort {
    cursor: pointer !important;
    user-select: none;
    transition: background-color 0.15s;
}
.th-dash-sort:hover {
    background-color: #e2e8f0 !important;
    color: var(--erp-primary) !important;
}
.th-dash-sort i {
    font-size: 11px;
    vertical-align: middle;
}
.th-dash-sort.active-sort {
    background-color: #dbeafe !important;
    color: #1e40af !important;
    font-weight: 700 !important;
}

/* 대시보드 순위 (동그라미 제거, 깔끔한 텍스트 표기) */
.rank-badge {
    display: inline-block;
    font-size: 11.5px;
    font-weight: 700;
    color: #475569;
    border: none !important;
    background: transparent !important;
    border-radius: 0 !important;
    padding: 0 !important;
    line-height: normal !important;
    width: auto !important;
    height: auto !important;
}
.rank-badge-1 { color: #0f172a !important; font-weight: 800 !important; }
.rank-badge-2 { color: #1e293b !important; font-weight: 700 !important; }
.rank-badge-3 { color: #334155 !important; font-weight: 700 !important; }
.rank-badge-normal { color: #64748b !important; }

/* 출고처(현장) 태그 & 더보기 뱃지 */
/* 출고처(현장) 전체 표기 텍스트 */
.dest-full-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    font-size: 11px;
    color: #1e293b;
    line-height: 1.35;
    padding: 1px 2px;
    display: block;
    cursor: help;
}

.dest-tag-box {
    display: flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
}
.dest-tag {
    font-size: 11px;
    color: #1e293b;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 2px;
    padding: 1px 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 130px;
    display: inline-block;
}
.dest-more-badge {
    font-size: 10px;
    background-color: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
    border-radius: 2px;
    padding: 0 4px;
    white-space: nowrap;
    cursor: help;
}

/* 원클릭 내역 추적 버튼 */
.btn-drilldown {
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    color: #3b82f6;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 2px;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    transition: all 0.15s;
    line-height: 16px;
    cursor: pointer;
}
.btn-drilldown:hover {
    background-color: #eff6ff;
    border-color: #3b82f6;
    color: #1d4ed8;
}

/* ── 스마트 활성 필터 칩 바 (.erp-active-filter-bar) ── */
.erp-active-filter-bar {
    background-color: #f1f5f9;
    border-bottom: 1px solid #cbd5e1;
    padding: 4px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 11px;
    animation: fadeIn 0.15s ease-in-out;
}
.filter-chip-label {
    font-size: 11px;
    font-weight: 600;
    color: #475569;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background-color: #ffffff;
    border: 1px solid #93c5fd;
    color: #1e3a8a;
    border-radius: 3px;
    padding: 1px 7px;
    font-size: 11px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.filter-chip strong {
    color: #2563eb;
    font-weight: 700;
}
.filter-chip-remove {
    cursor: pointer;
    color: #94a3b8;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    transition: color 0.15s;
}
.filter-chip-remove:hover {
    color: #ef4444;
}
.filter-clear-all {
    font-size: 11px !important;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    cursor: pointer;
}
.filter-clear-all:hover {
    color: #dc2626 !important;
    text-decoration: underline !important;
}

/* ── 품목/규격 상세 내역 모달 (#specDetailModal) ── */
#modalSpecDetailTable th, #modalSpecDetailTable td {
    padding: 3px 6px;
    font-size: 11px;
}
#modalSpecDetailTable tbody tr:hover {
    background-color: #f1f5f9;
}

/* ── 9. 모달 및 인쇄 서식 ── */
.modal-backdrop.show {
    opacity: 0.45;
}
.modal-content {
    border-radius: 2px !important;
    border: 1px solid #475569 !important;
}

/* 화면 모드에서는 인쇄 전용 헤더/푸터/tfoot 숨김 */
.print-only-header,
.print-only-footer,
tfoot.print-only-tfoot {
    display: none;
}

/* ── 10. A4 세로 규격 정통 ERP 실적원장 인쇄 서식 (@media print) ── */
@media print {
    @page {
        size: A4 portrait;
        margin: 8mm 6mm;
    }

    body {
        padding: 0 !important;
        margin: 0 !important;
        background: #ffffff !important;
        font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Malgun Gothic", sans-serif !important;
        color: #0f172a !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* 1. 화면 전용 UI 완전 숨김 */
    .no-print,
    .erp-top-toolbar,
    .erp-filter-ribbon,
    .erp-summary-strip,
    .erp-active-filter-bar,
    .col-resizer,
    .btn-erp,
    .modal,
    .modal-backdrop,
    #paginationControls,
    .btn-row-del {
        display: none !important;
    }

    /* 2. 웹 하이퍼링크 파란색 제거 -> 정통 회계 다크톤/차콜 전면 전환 */
    .text-primary,
    .td-item,
    .td-total,
    a,
    .badge {
        color: #0f172a !important;
        text-decoration: none !important;
    }
    .td-item {
        font-weight: 700 !important;
        color: #0f172a !important;
    }
    .td-total {
        font-weight: 700 !important;
        color: #000000 !important;
    }

    /* 3. 인쇄 전용 공식 ERP 보고서 헤더 */
    .print-only-header {
        display: block !important;
        margin-bottom: 7px !important;
    }
    .print-title-area {
        text-align: center !important;
        padding-bottom: 5px !important;
        margin-bottom: 5px !important;
        border-bottom: 2px solid #0f172a !important;
    }
    .print-main-title {
        font-size: 15pt !important;
        font-weight: 800 !important;
        letter-spacing: 5px !important;
        color: #0f172a !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    .print-meta-grid {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        font-size: 7.5pt !important;
        color: #334155 !important;
        padding: 2px 2px 4px 2px !important;
        border-bottom: 1px solid #94a3b8 !important;
    }
    .print-meta-row {
        display: flex !important;
        gap: 5px !important;
        align-items: center !important;
    }
    .meta-label {
        color: #64748b !important;
        font-weight: 600 !important;
    }
    .meta-val {
        color: #0f172a !important;
        font-weight: 600 !important;
    }
    .meta-sep {
        color: #cbd5e1 !important;
    }
    .print-meta-stats strong {
        font-weight: 700 !important;
        color: #0f172a !important;
    }

    /* 4. 오름/내림차순 정렬 아이콘 출력물에서 삭제 */
    .erp-sheet-table th i,
    .erp-sheet-table th .bx,
    .erp-sheet-table th svg {
        display: none !important;
    }

    /* 5. No, 전표번호, 체크박스, 관리 열, 대시보드 내역추적 열 삭제(숨김) */
    .th-check, .td-check,
    .th-no, .td-no,
    .th-voucher, .td-voucher,
    .th-action, .td-action,
    .th-dash-action, .td-dash-action,
    .btn-drilldown,
    #dashboardSpecTable th:last-child,
    #dashboardSpecTable td:last-child {
        display: none !important;
    }

    /* 6. 인라인 편집 커서 제거 */
    .is-inline-editable {
        cursor: default !important;
    }

    /* 7. A4 세로 100% 폭 맞춤 테이블 레이아웃 */
    .erp-grid-wrapper {
        max-height: none !important;
        height: auto !important;
        overflow: visible !important;
        border: none !important;
        width: 100% !important;
        box-shadow: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .erp-sheet-table {
        width: 100% !important;
        min-width: 0 !important;
        table-layout: fixed !important;
        border-collapse: collapse !important;
        border-top: 2px solid #0f172a !important;
        border-bottom: 2px solid #0f172a !important;
        border-left: 1px solid #cbd5e1 !important;
        border-right: 1px solid #cbd5e1 !important;
        background-color: transparent !important;
        background: transparent !important;
    }

    .erp-sheet-table tbody {
        background-color: transparent !important;
        background: transparent !important;
    }

    .erp-sheet-table thead {
        display: table-header-group !important;
    }

    .erp-sheet-table tr {
        page-break-inside: avoid !important;
    }

    .erp-sheet-table th {
        background-color: #f1f5f9 !important;
        color: #0f172a !important;
        font-weight: 700 !important;
        text-align: center !important;
        font-size: 7pt !important;
        line-height: 1.2 !important;
        height: auto !important;
        padding: 3.5px 2px !important;
        border-top: 2px solid #0f172a !important;
        border-bottom: 1.5px solid #334155 !important;
        border-left: 1px solid #cbd5e1 !important;
        border-right: 1px solid #cbd5e1 !important;
        min-width: 0 !important;
        box-shadow: none !important;
    }

    .erp-sheet-table td {
        border-bottom: 1px solid #e2e8f0 !important;
        border-left: 1px solid #f1f5f9 !important;
        border-right: 1px solid #f1f5f9 !important;
        font-size: 7pt !important;
        line-height: 1.2 !important;
        height: auto !important;
        padding: 2.8px 1.5px !important;
        min-width: 0 !important;
        box-shadow: none !important;
        color: #1e293b !important;
        overflow: hidden !important;
    }

    /* 짝수 행 은은한 음영(Zebra striping)으로 가독성 향상 */
    .erp-sheet-table tbody tr:nth-child(even) td {
        background-color: #f8fafc !important;
    }

    /* [내역 목록] A4 세로 10개 열 너비 비율 최적화 (부가세/합계금액 생략, 품목명/규격 1줄 확보, 합계 100%) */
    .th-date        { width: 9.0% !important; text-align: center !important; }
    .th-category    { width: 6.5% !important; text-align: center !important; }
    .th-supplier    { width: 11.0% !important; text-align: left !important; }
    .th-destination { width: 13.5% !important; text-align: left !important; }
    .th-item        { width: 18.0% !important; text-align: left !important; }
    .th-spec        { width: 15.0% !important; text-align: left !important; }
    .th-unit        { width: 3.5% !important; text-align: center !important; }
    .th-qty         { width: 6.0% !important; text-align: right !important; }
    .th-price       { width: 7.5% !important; text-align: right !important; }
    .th-supply      { width: 10.0% !important; text-align: right !important; }
    .th-vat, .td-vat,
    .th-total, .td-total,
    .td-print-sum-vat, .td-print-sum-total,
    .th-memo, .td-memo { display: none !important; }

    /* [대시보드 순위표] A4 세로 열 너비 비율 최적화 (합계 100%) */
    #dashboardSpecTable th:nth-child(1), #dashboardSpecTable td:nth-child(1) { width: 5% !important; text-align: center !important; }
    #dashboardSpecTable th:nth-child(2), #dashboardSpecTable td:nth-child(2) { width: 14% !important; }
    #dashboardSpecTable th:nth-child(3), #dashboardSpecTable td:nth-child(3) { width: 12% !important; }
    #dashboardSpecTable th:nth-child(4), #dashboardSpecTable td:nth-child(4) { width: 5% !important; text-align: center !important; }
    #dashboardSpecTable th:nth-child(5), #dashboardSpecTable td:nth-child(5) { width: 17% !important; }
    #dashboardSpecTable th:nth-child(6), #dashboardSpecTable td:nth-child(6) { width: 7% !important; text-align: right !important; }
    #dashboardSpecTable th:nth-child(7), #dashboardSpecTable td:nth-child(7) { width: 8% !important; text-align: right !important; }
    #dashboardSpecTable th:nth-child(8), #dashboardSpecTable td:nth-child(8) { width: 12% !important; text-align: right !important; }
    #dashboardSpecTable th:nth-child(9), #dashboardSpecTable td:nth-child(9) { width: 10% !important; text-align: right !important; }
    #dashboardSpecTable th:nth-child(10), #dashboardSpecTable td:nth-child(10) { width: 10% !important; text-align: right !important; }

    /* 정렬 및 글자 쪼개짐(Word-Wrap) 원천 차단 & 금액 셀 가독성 최적화 */
    .td-date     { text-align: center !important; white-space: nowrap !important; }
    .td-category { text-align: center !important; white-space: nowrap !important; }
    .td-unit     { text-align: center !important; white-space: nowrap !important; }
    .td-qty, .td-price, .td-supply {
        text-align: right !important;
        font-variant-numeric: tabular-nums !important;
        white-space: nowrap !important;
        letter-spacing: -0.25px !important;
        text-overflow: clip !important;
        padding-left: 1px !important;
        padding-right: 1.5px !important;
    }

    .td-supplier, .td-destination, .td-item, .td-spec {
        word-break: break-all !important;
        white-space: normal !important;
    }

    /* 8. 표 하단 공식 회계 합계행 (마지막 페이지 마지막 행에만 1회 출력) */
    tfoot.print-only-tfoot {
        display: table-row-group !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }
    .tr-print-summary {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }
    .tr-print-summary td {
        background-color: #f1f5f9 !important;
        font-weight: 700 !important;
        color: #0f172a !important;
        font-size: 7pt !important;
        padding: 3.5px 1.5px !important;
        letter-spacing: -0.25px !important;
        border-top: 1.5px solid #0f172a !important;
        border-bottom: 2.5px double #0f172a !important;
        border-left: 1px solid #cbd5e1 !important;
        border-right: 1px solid #cbd5e1 !important;
    }
    .td-print-sum-label {
        text-align: center !important;
        letter-spacing: 2px !important;
    }

    /* 9. 문서 바닥글 완전 숨김 */
    .print-only-footer {
        display: none !important;
    }

    /* 대시보드 KPI 카드 그리드: A4 세로 인쇄 시 1행 3개, 2행 3개 (3x2 균형 배치) */
    .dashboard-kpi-grid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 6px !important;
        margin-bottom: 8px !important;
    }
    .kpi-card {
        padding: 5px 8px !important;
        border: 1px solid #cbd5e1 !important;
        box-shadow: none !important;
        background: #ffffff !important;
    }
    .kpi-card .kpi-title {
        font-size: 7.5pt !important;
        color: #475569 !important;
        margin-bottom: 2px !important;
    }
    .kpi-card .kpi-val {
        font-size: 11pt !important;
        font-weight: 700 !important;
        color: #0f172a !important;
        line-height: 1.2 !important;
    }

    /* 대시보드 차트 인쇄 시 수직 정렬 */
    .chart-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
    }
    .chart-box {
        width: 100% !important;
        page-break-inside: avoid !important;
    }
}
