@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

/* Reset & Base - Navy Slate Fixed */
* {
    box-sizing: border-box;
    outline: none;
    border-radius: 0 !important;
}

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #334155; /* 본문: 밝은 청회색 */
    color: #f1f5f9;
    height: 100vh;
    overflow: hidden;
}

/* ERP Layout Grid */
.erp-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #334155;
}

/* --- Header --- */
.erp-header {
    height: auto;
    min-height: 50px;
    background-color: #1e293b; /* 메뉴: 약간 짙은 청회색 */
    border-bottom: 1px solid #475569;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap; /* 모바일에서 줄바꿈 허용 */
    gap: 8px; /* 줄바꿈 시 간격 */
    padding: 8px 16px;
    z-index: 20;
}

.brand .app-title {
    font-weight: 600;
    font-size: 16px;
    color: #f8fafc;
    letter-spacing: -0.5px;
}

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

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background-color: #475569; /* 입력창: 밝은 회색 */
    border-radius: 0;
    padding: 2px 8px;
    border: 1px solid #64748b;
    transition: all 0.2s;
}

.search-wrapper:focus-within {
    background-color: #334155;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

#searchInput {
    border: none;
    background: transparent;
    font-size: 13px;
    width: 200px;
    padding: 6px;
    color: #f8fafc;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    border-radius: 0;
    color: #cbd5e1;
    transition: background 0.2s;
}

.icon-btn:hover {
    background-color: #475569;
    color: #f8fafc;
}

/* --- Main Content (Data Grid) --- */
.erp-content {
    flex: 1;
    overflow: hidden;
    position: relative;
    background-color: #334155; /* 본문 기본 밝은 청회색 */
    padding: 0;
}

.table-frame {
    height: 100%;
    overflow: auto;
}

#dataTable {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background-color: #334155; /* 테이블 배경도 같은 톤 */
    table-layout: auto;
}

/* Sticky Header */
#dataTable thead th {
    position: sticky;
    top: 0;
    background-color: #1e293b; /* 테이블 헤더 짙은 테마 통일 */
    color: #cbd5e1;
    font-weight: 600;
    text-align: left;
    padding: 8px 12px;
    border-bottom: 2px solid #64748b;
    border-right: 1px solid #475569;
    white-space: nowrap;
    z-index: 10;
    user-select: none;
}

#dataTable thead th:last-child {
    border-right: none;
}

#dataTable tbody td {
    padding: 0;
    border-bottom: 1px solid #475569;
    border-right: 1px solid #475569;
}

/* Spreadsheet-like Inputs */
#dataTable input {
    width: 100%;
    height: 32px;
    padding: 0 12px;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 13px;
    color: #f1f5f9;
    transition: background 0.1s;
}

#dataTable input:focus {
    background-color: #475569; /* 포커스 시 살짝 밝게 */
    box-shadow: inset 0 0 0 2px #3b82f6;
    z-index: 2;
    position: relative;
}

/* Row Hover */
#dataTable tbody tr:hover td {
    background-color: #475569;
}

#dataTable tbody tr:hover input {
    background-color: transparent;
}

/* Special Columns */
.sort-indicator,
.action-icon {
    border: none;
    background: none;
    font-size: 11px;
    cursor: pointer;
    color: #94a3b8;
    margin-left: 4px;
    padding: 0;
}

.sort-indicator:hover,
.action-icon:hover {
    color: #cbd5e1;
}

/* Checkbox styling (Column 12) */
#dataTable td:last-child {
    text-align: center;
}

#dataTable input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 8px auto;
    cursor: pointer;
    display: block;
}

/* Quantity column */
#dataTable td:nth-child(6) input {
    color: #f8fafc !important;
    font-weight: 500;
    text-align: right;
}

/* Remark column (비고) - Red: displayOrder에서 8번째 열 */
#dataTable td:nth-child(8) input {
    color: #fca5a5 !important;
    font-weight: 600;
}

/* Completed Row Styling */
tr.faded-text td,
tr.faded-text input {
    color: #94a3b8 !important;
    text-decoration: line-through;
    background-color: #1e293b;
}

/* --- Footer (Action Bar) --- */
.erp-footer {
    height: auto;
    min-height: 56px;
    background-color: #1e293b; /* 메뉴: 하단 약간 짙은 청회색 */
    border-top: 1px solid #475569;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap; /* 모바일 줄바꿈 허용 */
    gap: 8px;
    padding: 8px 16px;
    z-index: 20;
}

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

.separator {
    width: 1px;
    height: 24px;
    background-color: #475569;
    margin: 0 8px;
}

.erp-btn {
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 0;
    border: 1px solid #475569;
    background-color: #334155;
    color: #e2e8f0;
    cursor: pointer;
    transition: all 0.1s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.erp-btn:hover {
    background-color: #475569;
    border-color: #64748b;
    color: #f1f5f9;
}

.erp-btn:active {
    transform: translateY(1px);
}

.erp-btn.primary {
    background-color: #2563eb;
    border-color: #3b82f6;
    color: white;
}

.erp-btn.primary:hover {
    background-color: #1d4ed8;
}

.erp-btn.danger {
    background-color: #334155;
    border-color: #7f1d1d;
    color: #fca5a5;
}

.erp-btn.danger:hover {
    background-color: #451a1a;
    border-color: #ef4444;
}

/* Company Group Border */
.company-group-border td {
    border-top: 2px solid #eab308 !important;
}

/* Type colors */
.type-black { color: #e2e8f0 !important; font-weight: bold; }
.type-red { color: #ef4444 !important; font-weight: bold; }