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

:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-color: #f1f5f9;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --sidebar-width: 250px;
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1e293b 0%, #334155 100%);
    color: white;
    position: fixed;
    height: 100vh;
    padding: 20px 0;
    overflow-y: auto;
}

.logo {
    padding: 10px 25px 30px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 20px;
}

.logo h2 {
    font-size: 28px;
    font-weight: 700;
    color: #60a5fa;
}

.logo span {
    font-size: 14px;
    color: #94a3b8;
}

.nav-menu {
    list-style: none;
}

.nav-item {
    padding: 15px 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
}

.nav-item.active {
    background: rgba(96, 165, 250, 0.2);
    border-left-color: #60a5fa;
}

.nav-item .icon {
    font-size: 18px;
}

.nav-item .arrow {
    margin-left: auto;
    font-size: 10px;
    transition: transform 0.2s;
}

.nav-item.has-submenu.open .arrow {
    transform: rotate(180deg);
}

/* Submenu */
.submenu {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(0,0,0,0.15);
}

.submenu.open {
    max-height: 500px;
}

.submenu-item {
    padding: 12px 25px 12px 50px !important;
    font-size: 14px;
}

.submenu-item:hover {
    background: rgba(255,255,255,0.05);
}

.submenu-item.active {
    background: rgba(96, 165, 250, 0.25);
    border-left-color: #60a5fa;
    color: #93c5fd;
    font-weight: 600;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-width: calc(100vw - var(--sidebar-width));
}

.top-bar {
    background: var(--card-bg);
    padding: 12px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    z-index: 100;
}

.top-bar h1 {
    font-size: 22px;
    font-weight: 600;
}

.content {
    padding: 10px;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 12px 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 10px;
}

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

.card-title {
    font-size: 18px;
    font-weight: 600;
}

/* Dashboard Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 12px 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.stat-card .label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.stat-card .value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-card .change {
    font-size: 13px;
    margin-top: 8px;
}

.stat-card .change.positive {
    color: var(--success-color);
}

.stat-card .change.negative {
    color: var(--danger-color);
}

/* Tables */
.table-container {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 60vh;
    position: relative;
}

#prodDailyTableContainer,
#purchaseRecvTableContainer {
    max-height: calc(100vh - 260px) !important;
    overflow-y: auto !important;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
    border: 1px solid var(--border-color);
}

th, td {
    padding: 6px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
}

th {
    background: #f1f5f9 !important;
    font-weight: 700;
    color: var(--text-primary);
    position: sticky !important;
    top: 0 !important;
    z-index: 10 !important;
    text-align: center !important;
    border-bottom: none !important;
    box-shadow: inset 0 -2px 0 var(--border-color);
}

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

thead th {
    background: #f1f5f9 !important;
}

/* 수불부 테이블: thead stacking context 제거하여 왼쪽 고정열이 날짜 헤더 위에 오도록 */
.ledger-freeze-table > thead {
    position: static !important;
    top: auto !important;
    z-index: auto !important;
}

tr:hover {
    background: #f8fafc;
}

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

.text-center {
    text-align: center;
}

/* Upload Area */
.upload-area {
    border: 2px dashed #cbd5e1;
    border-radius: 14px;
    padding: 36px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
}

.upload-area:hover {
    border-color: #3b82f6;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
}

.upload-area.dragover {
    border-color: #3b82f6;
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    box-shadow: 0 0 0 4px rgba(59,130,246,0.12);
}

.upload-area .icon {
    font-size: 44px;
    margin-bottom: 12px;
}

.upload-area h3 {
    margin-bottom: 6px;
    color: #334155;
    font-size: 15px;
    font-weight: 600;
}

.upload-area p {
    color: #94a3b8;
    font-size: 13px;
}

.upload-area input[type="file"] {
    display: none;
}

.upload-progress {
    margin-top: 20px;
}

.upload-progress .progress-bar {
    height: 12px;
    margin-bottom: 10px;
}

.upload-result {
    margin-top: 20px;
    padding: 14px 16px;
    border-radius: 10px;
    font-size: 14px;
}

.upload-result.success {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    color: #166534;
    border: 1px solid #86efac;
}

.upload-result.warning {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
    border: 1px solid #fcd34d;
}

.upload-result.error {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: #991b1b;
    border: 1px solid #fca5a5;
}

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

.btn-success:hover {
    background: #16a34a;
}

.btn-danger {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fecaca;
}

.btn-danger:hover {
    background: #dc2626;
    color: white;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #cbd5e1;
    border-radius: 20px;
    transition: 0.2s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 2px;
    bottom: 2px;
    background: white;
    border-radius: 50%;
    transition: 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
    background: #22c55e;
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(16px);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: #fff;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    transform: translateY(24px) scale(0.97);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 20px 60px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.05);
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border-radius: 16px 16px 0 0;
}

.modal-header h3 {
    font-size: 17px;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.3px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #94a3b8;
    padding: 4px;
    line-height: 1;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.modal-close:hover {
    color: #475569;
    background: rgba(0,0,0,0.06);
}

.modal-body {
    padding: 24px;
}

.modal-body .form-group {
    margin-bottom: 4px;
}

.modal-body .form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.modal-body .form-group input,
.modal-body .form-group select,
.modal-body .form-group textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    color: #1e293b;
    background: #f8fafc;
    transition: all 0.15s;
    box-sizing: border-box;
}

.modal-body .form-group input:focus,
.modal-body .form-group select:focus,
.modal-body .form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.modal-body .btn-primary {
    padding: 11px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 10px;
    letter-spacing: 0.2px;
    box-shadow: 0 2px 8px rgba(59,130,246,0.25);
    transition: all 0.15s;
}

.modal-body .btn-primary:hover {
    box-shadow: 0 4px 14px rgba(59,130,246,0.35);
    transform: translateY(-1px);
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 0 0 16px 16px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Filters */
.filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-group label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.filter-group input,
.filter-group select {
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    min-width: 0;
    box-sizing: border-box;
    width: auto;
}

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

.btn {
    padding: 7px 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

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

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

.btn-secondary {
    background: #e2e8f0;
    color: var(--text-primary);
}

/* Charts Container */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-blue {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge-green {
    background: #dcfce7;
    color: #166534;
}

.badge-yellow {
    background: #fef3c7;
    color: #92400e;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

.pagination button {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 6px;
    cursor: pointer;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination span {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Loading */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px;
    color: var(--text-secondary);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
        padding: 10px 0;
        transition: width 0.3s;
        z-index: 1000;
    }

    .sidebar.expanded {
        width: 250px;
    }

    .sidebar .logo span,
    .sidebar .nav-item span:not(.icon),
    .sidebar .arrow {
        display: none;
    }

    .sidebar.expanded .logo span,
    .sidebar.expanded .nav-item span:not(.icon),
    .sidebar.expanded .arrow {
        display: inline;
    }

    .sidebar .logo {
        padding: 10px 5px 20px;
    }

    .sidebar.expanded .logo {
        padding: 10px 25px 30px;
    }

    .sidebar .logo h2 {
        font-size: 14px;
        text-align: center;
    }

    .sidebar.expanded .logo h2 {
        font-size: 28px;
        text-align: left;
    }

    .sidebar .nav-item {
        justify-content: center;
        padding: 12px 5px;
    }

    .sidebar.expanded .nav-item {
        justify-content: flex-start;
        padding: 15px 25px;
    }

    .sidebar .nav-item .icon {
        font-size: 20px;
    }

    .sidebar .submenu {
        max-height: 0;
        overflow: hidden;
    }

    .sidebar.expanded .submenu.open {
        max-height: 500px;
    }

    .main-content {
        margin-left: 60px;
        transition: margin-left 0.3s;
    }

    .sidebar.expanded ~ .main-content {
        margin-left: 250px;
    }

    /* 모바일 메뉴 오버레이 */
    .mobile-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 60px;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }

    .mobile-overlay.active {
        display: block;
    }

    .content {
        padding: 10px;
    }

    .top-bar {
        padding: 15px;
    }

    .top-bar h1 {
        font-size: 18px;
    }

    .card {
        padding: 12px;
        border-radius: 8px;
    }

    .card-title {
        font-size: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-card .value {
        font-size: 22px;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .filters {
        flex-direction: column;
        gap: 10px;
    }

    .filter-group {
        width: 100%;
    }

    .filter-group input,
    .filter-group select {
        width: 100%;
        min-width: unset;
    }

    /* 매출현황 두 테이블 세로 배치 */
    .summary-tables-container {
        flex-direction: column !important;
    }

    .summary-tables-container .card {
        width: 100% !important;
        flex: none !important;
    }

    /* 테이블 모바일 최적화 */
    .table-container {
        max-height: 50vh;
        margin: 0 -15px;
        width: calc(100% + 30px);
    }

    table {
        font-size: 11px;
    }

    th, td {
        padding: 8px 6px;
        white-space: nowrap;
    }

    /* 모달 모바일 최적화 */
    .modal {
        width: 95%;
        max-height: 85vh;
    }

    .modal-header {
        padding: 15px;
    }

    .modal-body {
        padding: 15px;
    }

    .modal-footer {
        padding: 12px 15px;
    }

    /* 버튼 모바일 최적화 */
    .btn {
        padding: 10px 16px;
        font-size: 13px;
    }

    .btn-sm {
        padding: 8px 12px;
        font-size: 12px;
    }

    /* 탭 모바일 최적화 */
    .tab-buttons {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab-btn {
        padding: 10px 16px;
        font-size: 13px;
        white-space: nowrap;
    }

    /* BOM 테이블 모바일 */
    .bom-table {
        font-size: 11px;
    }

    .bom-input {
        padding: 4px 6px;
        font-size: 11px;
    }

    /* 페이지네이션 모바일 */
    .pagination {
        flex-wrap: wrap;
        gap: 8px;
    }

    .pagination button {
        padding: 6px 12px;
        font-size: 12px;
    }

    /* 드롭다운 필터 모바일 */
    .filter-dropdown {
        position: fixed;
        left: 15px !important;
        right: 15px !important;
        width: auto !important;
        max-width: none !important;
        top: 50% !important;
        transform: translateY(-50%);
        max-height: 70vh;
    }
}

/* 14인치 노트북 등 중간 화면 (1400px 이하) */
@media (max-width: 1400px) {
    :root {
        --sidebar-width: 200px;
    }

    .sidebar .logo {
        padding: 10px 15px 20px;
    }

    .sidebar .logo h2 {
        font-size: 22px;
    }

    .nav-item {
        padding: 12px 15px;
        gap: 8px;
        font-size: 13px;
    }

    .submenu-item {
        padding: 10px 15px 10px 40px !important;
        font-size: 13px;
    }

    .content {
        padding: 10px;
    }

    .top-bar {
        padding: 15px 20px;
    }

    .top-bar h1 {
        font-size: 20px;
    }

    table {
        font-size: 12px;
    }

    th, td {
        padding: 8px 8px;
        white-space: nowrap;
    }

    .card {
        padding: 12px;
    }

    .stat-card .value {
        font-size: 22px;
    }

    .filters {
        gap: 8px;
    }

    .filter-group input,
    .filter-group select {
        padding: 5px 6px;
        font-size: 12px;
    }

    .btn {
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* 더 작은 노트북 (1200px 이하) */
@media (max-width: 1200px) {
    :root {
        --sidebar-width: 180px;
    }

    .nav-item {
        padding: 10px 12px;
        font-size: 12px;
    }

    .submenu-item {
        padding: 8px 12px 8px 35px !important;
        font-size: 12px;
    }

    table {
        font-size: 11px;
    }

    .hr-status-table {
        font-size: 11px !important;
    }
    .hr-status-table th, .hr-status-table td {
        padding: 4px 6px;
    }

    th, td {
        padding: 6px 6px;
    }

    .content {
        padding: 10px;
    }
}

/* 더 작은 화면 (480px 이하) */
@media (max-width: 480px) {
    .sidebar {
        width: 50px;
    }

    .sidebar .logo h2 {
        font-size: 12px;
    }

    .sidebar .nav-item .icon {
        font-size: 18px;
    }

    .main-content {
        margin-left: 50px;
    }

    .content {
        padding: 10px;
    }

    .top-bar h1 {
        font-size: 16px;
    }

    table {
        font-size: 10px;
    }

    .hr-status-table {
        font-size: 10px !important;
    }
    .hr-status-table th, .hr-status-table td {
        padding: 3px 4px;
    }

    th, td {
        padding: 6px 4px;
    }

    .stat-card .value {
        font-size: 18px;
    }
}

/* Money formatting */
.money {
    font-family: 'Roboto Mono', monospace;
}

/* Progress bar */
.progress-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar .fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Rank list */
.rank-list {
    list-style: none;
}

.rank-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.rank-item:last-child {
    border-bottom: none;
}

.rank-number {
    width: 28px;
    height: 28px;
    background: #e2e8f0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    margin-right: 12px;
}

.rank-item:nth-child(1) .rank-number {
    background: #fef3c7;
    color: #92400e;
}

.rank-item:nth-child(2) .rank-number {
    background: #e2e8f0;
    color: #475569;
}

.rank-item:nth-child(3) .rank-number {
    background: #fed7aa;
    color: #9a3412;
}

.rank-info {
    flex: 1;
}

.rank-name {
    font-weight: 500;
    margin-bottom: 2px;
}

.rank-detail {
    font-size: 12px;
    color: var(--text-secondary);
}

.rank-value {
    font-weight: 600;
    font-size: 15px;
}

/* Tab Styles */
.tab-container {
    margin-bottom: 20px;
}

.tab-buttons {
    display: inline-flex;
    gap: 4px;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 3px;
}

.tab-btn {
    padding: 8px 20px;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    border-radius: 6px;
    transition: all 0.15s ease;
}

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

.tab-btn.active {
    color: var(--primary-color);
    background: white;
    font-weight: 700;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.tab-btn.active::after {
    display: none;
}

.dash-tab {
    padding: 8px 20px;
    border: 2px solid #e2e8f0;
    background: white;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.15s ease;
}

.dash-tab:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.dash-tab.active {
    color: white;
    background: var(--primary-color);
    border-color: var(--primary-color);
    font-weight: 700;
}

/* Checkbox styling */
.customer-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

#selectAllCustomers {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* BOM Product Item */
.bom-product-item {
    transition: all 0.15s;
}

.bom-product-item:hover {
    background: #f8fafc;
}

.bom-product-item.selected {
    background: #dbeafe;
    border-left: 3px solid var(--primary-color);
}

/* BOM Editable Table */
.bom-table th {
    background: #f8fafc;
    padding: 8px;
    font-size: 12px;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
    position: sticky;
    top: 0;
}

.bom-table td {
    padding: 2px;
    border-bottom: 1px solid #eee;
}

.bom-input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 13px;
    background: transparent;
    box-sizing: border-box;
}

.bom-input:hover {
    border-color: #ddd;
}

.bom-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
}

.bom-new-row {
    background: #f8fafc;
}

.bom-new-row .bom-input {
    background: white;
    border-color: #ddd;
}

.bom-table select.bom-input {
    cursor: pointer;
}

/* Sortable Table Headers */
th.sortable {
    cursor: pointer;
    user-select: none;
}

th.sortable:hover {
    background: #e2e8f0;
}

.sort-icon {
    margin-left: 4px;
    opacity: 0.3;
    font-size: 12px;
}

/* 직원현황 테이블 중앙정렬 */
.hr-status-table th,
.center-table td {
    text-align: center;
}

.hr-status-table td {
    text-align: center;
}

/* Type Filter Buttons */
.type-filter-btn {
    border: 2px solid transparent !important;
    transition: all 0.2s;
}

.type-filter-btn.active {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 1px var(--primary-color);
}

/* Filter Dropdown */
.dropdown-filter {
    position: relative;
}

.filter-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 100;
    width: max-content;
    min-width: 180px;
    max-width: 500px;
    max-height: 400px;
    overflow-x: hidden;
    overflow-y: auto;
}

.filter-dropdown > div:nth-child(3) {
    max-height: 250px;
    overflow-y: auto;
    overflow-x: hidden;
}

.filter-dropdown label {
    display: flex !important;
    align-items: center;
    gap: 3px;
    padding: 1px 0 !important;
    border-bottom: 1px solid #f0f0f0;
    font-size: 12px;
    white-space: nowrap;
    margin: 0 !important;
    cursor: pointer;
    line-height: 1.2;
}

.filter-dropdown label:last-child {
    border-bottom: none;
}

.filter-dropdown label:hover {
    color: var(--primary-color);
}

.filter-dropdown input[type="checkbox"] {
    width: 12px;
    height: 12px;
    margin: 0 !important;
    flex-shrink: 0;
    cursor: pointer;
}

/* Autocomplete Dropdown */
.autocomplete-container {
    position: relative;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 250px;
    overflow-y: auto;
    background: white;
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 6px 6px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.autocomplete-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background: #e0f2fe;
}

.autocomplete-item.new-group {
    background: #f0fdf4;
    color: #166534;
    font-weight: 500;
}

.autocomplete-item.new-group:hover,
.autocomplete-item.new-group.selected {
    background: #dcfce7;
}
/* Product Tooltip */
.product-tooltip {
    position: fixed;
    background: #1e293b;
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    z-index: 10000;
    max-width: 350px;
    max-height: 300px;
    overflow-y: auto;
    font-size: 13px;
}

.product-tooltip .tooltip-title {
    font-weight: 600;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    color: #60a5fa;
}

.product-tooltip .tooltip-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.product-tooltip .tooltip-list li {
    padding: 3px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.product-tooltip .tooltip-list li:last-child {
    border-bottom: none;
}

/* Product Cell */
.product-cell {
    cursor: default;
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-cell[data-products]:not([data-products=""]) {
    cursor: help;
}

/* Subtotal Row */
.subtotal-row td {
    border-top: 2px solid var(--border-color);
}

/* View Mode Button */
.view-mode-btn {
    padding: 8px 14px !important;
    font-size: 13px !important;
}

/* 매출현황 왼쪽 테이블 최적화 */
/* 필터 태그 박스 */
.filter-tags-box {
    min-height: 32px;
    padding: 3px 6px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    min-width: 240px;
    max-width: 500px;
}
.filter-tags-box:hover { border-color: var(--primary-color); }
.filter-tags-placeholder { color: #aaa; font-size: 13px; pointer-events: none; }
.filter-tags-box:focus-within .filter-tags-placeholder { display: none; }
.filter-tags-box input[type="text"] { border: none !important; outline: none !important; box-shadow: none !important; }
.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: #e0e7ff;
    color: #3b52a0;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
}
.filter-tag-x {
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    margin-left: 2px;
    color: #6b7280;
    line-height: 1;
}
.filter-tag-x:hover { color: #dc2626; }

.sales-summary-table {
    overflow-x: hidden !important;
}

.sales-summary-table table {
    table-layout: fixed;
    width: 100%;
    font-size: 12px;
}

.sales-summary-table th,
.sales-summary-table td {
    padding: 8px 4px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sales-summary-table th:nth-child(1),
.sales-summary-table td:nth-child(1) { width: 18%; } /* 매출처 */
.sales-summary-table th:nth-child(2),
.sales-summary-table td:nth-child(2) { width: 22%; } /* 품목 */
.sales-summary-table th:nth-child(3),
.sales-summary-table td:nth-child(3) { width: 12%; } /* 단가 */
.sales-summary-table th:nth-child(4),
.sales-summary-table td:nth-child(4) { width: 8%; } /* 수량 */
.sales-summary-table th:nth-child(5),
.sales-summary-table td:nth-child(5) { width: 14%; } /* 공급가 */
.sales-summary-table th:nth-child(6),
.sales-summary-table td:nth-child(6) { width: 10%; } /* VAT */
.sales-summary-table th:nth-child(7),
.sales-summary-table td:nth-child(7) { width: 16%; } /* 합계 */

@media (max-width: 768px) {
    .sales-summary-table table {
        font-size: 10px;
    }

    .sales-summary-table th,
    .sales-summary-table td {
        padding: 6px 2px;
    }
}

/* 생산일보 테이블 */
.prod-summary-row:hover {
    background: #f0f4ff !important;
}
.prod-detail-row:hover {
    background: #eef2ff !important;
}

/* MRP 모의입력 스피너 제거 */
.mrp-sim-input::-webkit-outer-spin-button,
.mrp-sim-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* MRP 품목수 툴팁 */
.mrp-tooltip-wrap .mrp-tooltip {
    display: none;
    position: fixed;
    background: #1e293b;
    color: #fff;
    font-size: 11px;
    padding: 8px 12px;
    border-radius: 6px;
    white-space: nowrap;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    line-height: 1.6;
    overflow: hidden;
    pointer-events: none;
}
.mrp-tooltip-wrap:hover .mrp-tooltip {
    display: block;
}

/* 홍채 직원번호 자동완성 */
.iris-ac-list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
}
.iris-ac-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    border-bottom: 1px solid #f1f5f9;
}
.iris-ac-item:last-child { border-bottom: none; }
.iris-ac-item:hover { background: #eff6ff; }

/* 물류비 테이블 자동 맞춤 */
.logistics-input {
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 4px 6px;
    font-size: 12px;
    background: #fff;
    outline: none;
    transition: border-color 0.15s;
}
.logistics-input:focus {
    border-color: var(--primary-color);
}
/* number input spinner 숨기기 */
.logistics-input[type="number"] {
    -moz-appearance: textfield;
}
.logistics-input[type="number"]::-webkit-inner-spin-button,
.logistics-input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
#logisticsAutoFitTable th,
#logisticsAutoFitTable td {
    padding: 6px 12px;
    white-space: nowrap;
    font-size: 12px;
}

/* 매출설정 좌우 2단 레이아웃 */
#salesSettingsGrid {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
}
#salesSettingsLeft .table-container {
    overflow-x: auto;
}

/* Updated Mon, Feb 24, 2026 */
