/* Shared AG Grid palette follows Employee Operations' grids.css reference. */
.erpx-unified-ag-grid {
    --ag-background-color: #fff;
    --ag-foreground-color: #181d1f;
    --ag-header-background-color: #f1f5f9;
    --ag-header-foreground-color: #2e3370;
    --ag-header-cell-hover-background-color: #e9edf4;
    --ag-odd-row-background-color: #fafafa;
    --ag-row-hover-color: #f0eff8;
    --ag-selected-row-background-color: #e9e7f5;
    --ag-border-color: #e5e7eb;
    --ag-row-border-color: #dcdedf;
    --ag-header-column-separator-color: #dcddea;
    --ag-header-column-resize-handle-color: #9599b8;
    border-radius: 12px;
}

.erpx-unified-ag-grid :is(.ag-header, .ag-header-cell, .ag-header-row,
    .ag-header-viewport, .ag-pinned-left-header, .ag-pinned-right-header) {
    background: #f1f5f9 !important;
    color: #2e3370 !important;
}

.erpx-unified-ag-grid :is(.ag-header-cell-text, .ag-header-icon,
    .ag-icon, .ag-header-cell-menu-button, .ag-header-cell-filter-button) {
    color: #2e3370 !important;
}

.erpx-unified-ag-grid .ag-header-cell-label {
    font-weight: 700;
}

.erpx-unified-ag-grid .ag-row-odd:not(.ag-row-pinned) {
    background: #fafafa;
}

.erpx-unified-ag-grid .ag-row-hover:not(.ag-row-pinned) {
    background: #f0eff8;
}

.erpx-unified-ag-grid .ag-row-selected:not(.ag-row-pinned) {
    background: #e9e7f5;
}

.erpx-grid-shell {
    border-color: #e5e7eb;
    border-radius: 12px;
}

.erpx-grid-shell > .erpx-grid-toolbar {
    min-height: 48px;
    padding: 7px 9px;
    background: #f1f5f9;
    border-color: #e5e7eb;
    gap: 10px;
    flex-wrap: wrap;
}

.erpx-grid-toolbar .erpx-grid-columns-button {
    min-height: 34px;
    border-radius: 8px;
    color: #2e3370;
    border-color: #dcddea;
    background: #fff;
}

.inventory-item-editor .item-main-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px 18px;
}

.inventory-item-editor :is(.item-master-header, .item-master-tabs) {
    padding: clamp(14px, 1.4vw, 20px);
    min-width: 0;
}

.inventory-item-editor .item-basics-title {
    margin: 0 0 16px;
    color: var(--primary-dark);
    font-size: .95rem;
    font-weight: 800;
}

.inventory-item-editor .compact-alert {
    padding: 8px 12px;
    font-size: .8rem;
    line-height: 1.6;
}

.inventory-item-editor .item-main-grid .check-field {
    min-height: 38px;
    margin: 0;
    background: #fafbfc;
    font-size: .82rem;
}

.inventory-item-editor .erp-form-grid > * {
    min-width: 0;
}

.inventory-item-editor .item-main-grid :is(.form-control, .form-select, .searchable-select-control) {
    min-height: 38px;
    border-radius: 6px;
    font-size: .85rem;
}

.inventory-item-editor .editor-tabs {
    gap: 6px;
    padding: 5px;
    margin: 0 0 18px;
    background: #f1f5f9;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

.inventory-item-editor .editor-tabs button {
    flex-shrink: 0;
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    color: #59607c;
}

.inventory-item-editor .editor-tabs button.active {
    color: #2e3370;
    background: #fff;
    box-shadow: 0 2px 6px #181d1f12;
}

.inventory-item-editor .editor-tabs button:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

.inventory-item-editor .inventory-ag-grid {
    max-height: none;
}

.inventory-item-editor .unit-defaults-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fafbfc;
}

.inventory-items-filter {
    grid-template-columns: minmax(240px, 2fr) minmax(180px, 1fr) 130px auto;
    gap: 14px;
}

@media (max-width: 1000px) {
    .inventory-item-editor .item-main-grid,
    .inventory-items-filter {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .inventory-item-editor .item-main-grid :is(.form-control, .form-select, .searchable-select-control) {
        min-height: 44px;
    }
    .inventory-item-editor .item-main-grid,
    .inventory-item-editor .unit-defaults-grid,
    .inventory-items-filter {
        grid-template-columns: minmax(0, 1fr);
    }

    .inventory-item-editor .item-main-grid .span-2 {
        grid-column: auto;
    }

    .inventory-item-editor .grid-section-title {
        flex-wrap: wrap;
    }
}

/* Compact, system-wide confirmation dialog. */
.swal2-popup.erpx-swal-popup {
    grid-template-columns: 58px minmax(0, 1fr) 32px !important;
    width: min(445px, calc(100vw - 32px)) !important;
    padding: 20px 20px 16px !important;
    border-radius: 9px !important;
    text-align: start !important;
}

.erpx-swal-popup .swal2-icon {
    grid-column: 1 !important;
    grid-row: 1 / span 2 !important;
    align-self: start !important;
    width: 42px !important;
    height: 42px !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 12px !important;
    background: #fff3ce !important;
    color: #df8b13 !important;
    font-size: 0.72rem !important;
}

.erpx-swal-popup .swal2-title {
    grid-column: 2 !important;
    grid-row: 1 !important;
    align-self: center !important;
    margin: 0 !important;
    padding: 0 !important;
    color: #1f2522 !important;
    font-size: 1.08rem !important;
    line-height: 1.45 !important;
    text-align: start !important;
}

.erpx-swal-popup .swal2-html-container {
    grid-column: 1 / 4 !important;
    grid-row: 3 !important;
    margin: 12px 0 0 !important;
    padding: 0 !important;
    color: #737b77 !important;
    font-size: 0.93rem !important;
    max-height: none !important;
    overflow: visible !important;
    line-height: 1.65 !important;
    text-align: start !important;
}

.erpx-swal-popup .swal2-close {
    grid-column: 3 !important;
    grid-row: 1 !important;
    position: static !important;
    align-self: start !important;
    justify-self: end !important;
    width: 28px !important;
    height: 28px !important;
    margin: 0 !important;
    color: #626b67 !important;
    font-size: 1.35rem !important;
}

.erpx-swal-popup .swal2-actions {
    grid-column: 1 / 4 !important;
    grid-row: 7 !important;
    direction: ltr !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    width: 100% !important;
    margin: 14px 0 0 !important;
    padding: 0 !important;
}

.erpx-swal-popup .swal2-actions button {
    min-width: 64px !important;
    min-height: 38px !important;
    margin: 0 !important;
    padding: 8px 16px !important;
    font-size: 0.88rem !important;
}

.erpx-swal-popup .erpx-swal-confirm {
    border: 1px solid #35266f !important;
    color: #35266f !important;
    background: whitesmoke !important;
}

.erpx-swal-popup .erpx-swal-cancel {
    border: 1px solid #c94747 !important;
    color: #b93434 !important;
    background: #fff !important;
}

@media (hover: hover) {
    .erpx-swal-popup .erpx-swal-confirm:hover {
        border-color: #35266f !important;
        color: #fff !important;
        background: #35266f !important;
    }

    .erpx-swal-popup .erpx-swal-cancel:hover {
        border-color: #c94747 !important;
        color: #a72d2d !important;
        background: #fff0f0 !important;
    }
}


.inventory-item-editor .item-identity-grid { grid-template-columns: 180px minmax(0,1fr) minmax(0,1fr); }
.inventory-item-editor .item-supplier-field { grid-column: span 2; }
@media(max-width:600px) { .inventory-item-editor .item-identity-grid { grid-template-columns: minmax(0,1fr); } .inventory-item-editor .item-supplier-field { grid-column:auto; } .inventory-item-editor .item-code-field { max-width:200px; } }
.erpx-notices { margin-inline:0; max-width:calc(100vw - 32px); }
.erpx-notice { width:100%; min-width:0; overflow-wrap:anywhere; }
